Parcourir la source

Update .gitignore with comprehensive exclusions

- Added node_modules, build outputs, and test directories
- Excluded temporary files and IDE configurations
- Added environment variable exclusions
- Kept example-docs for reference

Ensures clean repository without generated artifacts.
fszontagh il y a 3 mois
Parent
commit
877579caf2

+ 38 - 5
.gitignore

@@ -1,13 +1,46 @@
 # Environment variables
 .env
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
 # Dependencies
 node_modules/
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
 # Build output
 dist/
-# Logs
-*.log
-# OS
-.DS_Store
+build/
+
+# Test output
+test-output/
+test/
+*.test
+
 # IDE
 .vscode/
-.idea/
+.idea/
+*.swp
+*.swo
+*~
+
+# OS
+.DS_Store
+Thumbs.db
+
+# Temporary files
+*.tmp
+*.temp
+debug-parser.ts
+test-calculator.h
+IMPLEMENTATION_COMPLETE.md
+
+# Logs
+logs/
+*.log
+
+# Example docs (keep for reference)
+example-docs/

+ 0 - 1169
parser-implementation-plan.md

@@ -1,1169 +0,0 @@
-# Dynamic Source Code Documentation Parser - TypeScript Implementation Plan
-
-## Overview
-Create a modular source code parser in TypeScript that extracts documentation from comments and generates structured markdown files similar to the `/data/tui/docs` structure. The system will be language-agnostic with pluggable parsers, starting with C++, and will integrate into the existing `docs-rag` project as a new CLI command.
-
-## Architecture Design
-
-### 1. Integration with Current Project
-
-The parser will be integrated into the existing `docs-rag` TypeScript project structure:
-
-```
-src/
-├── cli/
-│   ├── index.ts                    # Existing CLI (add parser command)
-│   └── parser-commands.ts          # New parser-specific commands
-├── lib/
-│   └── parser/                     # New parser library
-│       ├── core/
-│       │   ├── interfaces.ts       # Abstract parser interface
-│       │   ├── documentation-generator.ts  # Markdown output generator
-│       │   ├── comment-parser.ts   # Generic comment extraction
-│       │   └── config.ts           # Configuration management
-│       ├── parsers/
-│       │   ├── base-parser.ts      # Base parser class
-│       │   ├── cpp-parser.ts       # C++ implementation
-│       │   ├── [future] python-parser.ts
-│       │   └── [future] java-parser.ts
-│       ├── ast/
-│       │   ├── nodes.ts            # AST node definitions
-│       │   └── visitor.ts          # Visitor pattern for traversal
-│       └── utils/
-│           ├── file-utils.ts       # File system operations
-│           ├── string-utils.ts      # Text processing utilities
-│           └── markdown-utils.ts    # Markdown generation helpers
-├── services/
-│   └── documentService.ts          # Existing service (extend for parser output)
-├── config/
-│   └── parser-config.ts            # Parser-specific configuration
-└── types/
-    └── parser-types.ts             # TypeScript type definitions
-```
-
-### 2. TypeScript Interface Design
-
-#### Parser Interface (src/lib/parser/core/interfaces.ts)
-```typescript
-// Core interfaces for language parsers
-export interface SourceLocation {
-  filePath: string;
-  line: number;
-  column: number;
-  endLine?: number;
-  endColumn?: number;
-}
-
-export interface DocumentationComment {
-  type: 'doxline' | 'doxyblock' | 'javadoc' | 'unknown';
-  rawContent: string;
-  brief: string;
-  detailed: string;
-  tags: DocTag[];
-  location: SourceLocation;
-}
-
-export interface DocTag {
-  name: string;
-  value: string;
-}
-
-export interface ASTNode {
-  type: 'namespace' | 'class' | 'struct' | 'function' | 'method' | 
-        'variable' | 'enum' | 'enum_value' | 'template' | 'module';
-  name: string;
-  documentation: DocumentationComment;
-  location: SourceLocation;
-  children: ASTNode[];
-  [key: string]: any; // Allow type-specific properties
-}
-
-export interface ILanguageParser {
-  getLanguage(): string;
-  getFileExtensions(): string[];
-  canParse(filePath: string): boolean;
-  parseFile(filePath: string): Promise<ASTNode[]>;
-}
-
-export interface DocumentationConfig {
-  outputDirectory: string;
-  indexTitle: string;
-  generatorName: string;
-  generateIndex: boolean;
-  generateModuleIndexes: boolean;
-  includePrivate: boolean;
-  includeSourceLinks: boolean;
-  sourceRootPath?: string;
-  theme: 'material' | 'github' | 'default';
-}
-
-export interface ParserConfig {
-  languages: string[];
-  includePatterns: string[];
-  excludePatterns: string[];
-  outputPath: string;
-  watchMode: boolean;
-  incremental: boolean;
-}
-```
-
-#### Documentation Generator (src/lib/parser/core/documentation-generator.ts)
-```typescript
-import { ASTNode, DocumentationConfig, SourceLocation } from './interfaces';
-import { FileUtils } from '../utils/file-utils';
-import { MarkdownUtils } from '../utils/markdown-utils';
-
-export class DocumentationGenerator {
-  private config: DocumentationConfig;
-  private moduleStack: string[] = [];
-  private modules: ModuleInfo[] = [];
-
-  constructor(config: DocumentationConfig) {
-    this.config = config;
-  }
-
-  async generate(nodes: ASTNode[]): Promise<void> {
-    // Create output directory structure
-    await this.createDirectoryStructure();
-    
-    // Generate main index
-    if (this.config.generateIndex) {
-      await this.generateIndex(nodes);
-    }
-    
-    // Generate module-specific documentation
-    await this.generateModuleDocumentation(nodes);
-    
-    // Generate individual node documentation
-    await this.generateNodeFiles(nodes);
-  }
-
-  private async createDirectoryStructure(): Promise<void> {
-    await FileUtils.ensureDirectory(this.config.outputDirectory);
-  }
-
-  private async generateIndex(nodes: ASTNode[]): Promise<void> {
-    const content = await this.generateIndexContent(nodes);
-    const indexPath = `${this.config.outputDirectory}/index.md`;
-    await FileUtils.writeFile(indexPath, content);
-  }
-
-  private async generateIndexContent(nodes: ASTNode[]): Promise<string> {
-    const modules = this.organizeByModule(nodes);
-    let content = `---
-generator: ${this.config.generatorName}
----
-
-# ${this.config.indexTitle}
-
-`;
-
-    for (const [moduleName, moduleNodes] of modules.entries()) {
-      content += this.generateModuleSection(moduleName, moduleNodes);
-    }
-
-    return content;
-  }
-
-  private organizeByModule(nodes: ASTNode[]): Map<string, ASTNode[]> {
-    const modules = new Map<string, ASTNode[]>();
-    
-    for (const node of nodes) {
-      const moduleName = this.extractModuleName(node);
-      if (!modules.has(moduleName)) {
-        modules.set(moduleName, []);
-      }
-      modules.get(moduleName)!.push(node);
-    }
-    
-    return modules;
-  }
-
-  private extractModuleName(node: ASTNode): string {
-    // Extract module name from namespace or file path
-    if (node.type === 'namespace') {
-      return node.name;
-    }
-    
-    // Extract from file path
-    const pathParts = node.location.filePath.split('/');
-    const fileName = pathParts[pathParts.length - 1];
-    const moduleName = fileName.replace(/\.(cpp|h|hpp|cxx|cc|c)$/, '');
-    
-    return moduleName;
-  }
-
-  private generateModuleSection(moduleName: string, nodes: ASTNode[]): string {
-    let section = `:material-package: [${moduleName}](${moduleName}/index.md)
-:   ${this.generateModuleDescription(nodes)}
-
-`;
-
-    const classes = nodes.filter(n => n.type === 'class' || n.type === 'struct');
-    const functions = nodes.filter(n => n.type === 'function' || n.type === 'method');
-
-    if (classes.length > 0) {
-      section += '## Types\n\n| Name | Description |\n| ---- | ----------- |\n';
-      for (const cls of classes) {
-        const desc = cls.documentation.brief || '';
-        section += `| [${cls.name}](${moduleName}/${cls.name}.md) | ${desc} |\n`;
-      }
-      section += '\n';
-    }
-
-    return section;
-  }
-
-  private async generateModuleDocumentation(nodes: ASTNode[]): Promise<void> {
-    const modules = this.organizeByModule(nodes);
-    
-    for (const [moduleName, moduleNodes] of modules.entries()) {
-      await this.generateModuleFile(moduleName, moduleNodes);
-    }
-  }
-
-  private async generateModuleFile(moduleName: string, nodes: ASTNode[]): Promise<void> {
-    const modulePath = `${this.config.outputDirectory}/${moduleName}`;
-    await FileUtils.ensureDirectory(modulePath);
-    
-    let content = `---
-generator: ${this.config.generatorName}
----
-
-# ${moduleName}
-
-`;
-
-    const classes = nodes.filter(n => n.type === 'class' || n.type === 'struct');
-    const functions = nodes.filter(n => n.type === 'function' || n.type === 'method');
-
-    if (classes.length > 0) {
-      content += '## Types\n\n| Name | Description |\n| ---- | ----------- |\n';
-      for (const cls of classes) {
-        const desc = cls.documentation.brief || '';
-        content += `| [${cls.name}](${cls.name}.md) | ${desc} |\n`;
-      }
-      content += '\n';
-    }
-
-    const indexPath = `${this.config.outputDirectory}/${moduleName}/index.md`;
-    await FileUtils.writeFile(indexPath, content);
-  }
-
-  private async generateNodeFiles(nodes: ASTNode[]): Promise<void> {
-    for (const node of nodes) {
-      if (node.type === 'class' || node.type === 'struct') {
-        await this.generateClassFile(node);
-      } else if (node.type === 'function' || node.type === 'method') {
-        await this.generateFunctionFile(node);
-      }
-    }
-  }
-
-  private async generateClassFile(node: ASTNode): Promise<void> {
-    const moduleName = this.extractModuleName(node);
-    const filePath = `${this.config.outputDirectory}/${moduleName}/${node.name}.md`;
-    
-    let content = `---
-generator: ${this.config.generatorName}
----
-
-# ${node.name}
-
-**${node.type} ${node.name}**
-
-${this.formatDocumentation(node.documentation)}
-
-`;
-
-    // Add functions
-    const methods = node.children.filter(n => n.type === 'function' || n.type === 'method');
-    if (methods.length > 0) {
-      content += '## Functions\n\n';
-      content += this.generateFunctionTable(methods);
-      content += '\n## Function Details\n\n';
-      content += this.generateFunctionDetails(methods);
-    }
-
-    await FileUtils.writeFile(filePath, content);
-  }
-
-  private async generateFunctionFile(node: ASTNode): Promise<void> {
-    const moduleName = this.extractModuleName(node);
-    const filePath = `${this.config.outputDirectory}/${moduleName}/${node.name}.md`;
-    
-    const content = `---
-generator: ${this.config.generatorName}
----
-
-# ${node.name}
-
-**function ${node.name}**
-
-${this.formatDocumentation(node.documentation)}
-
-## Signature
-
-\`\`\`${this.getLanguageForSyntax()}
-${node.signature || node.name}
-\`\`\`
-
-## Source Location
-
-File: \`${node.location.filePath}\`:${node.location.line}
-
-`;
-
-    await FileUtils.writeFile(filePath, content);
-  }
-
-  private generateFunctionTable(functions: ASTNode[]): string {
-    let table = '| Name | Description |\n| ---- | ----------- |\n';
-    
-    for (const func of functions) {
-      const desc = func.documentation.brief || '';
-      const anchor = this.generateAnchor(func.name);
-      table += `| [${func.name}](#${anchor}) | ${desc} |\n`;
-    }
-    
-    return table;
-  }
-
-  private generateFunctionDetails(functions: ASTNode[]): string {
-    let details = '';
-    
-    for (const func of functions) {
-      const anchor = this.generateAnchor(func.name);
-      details += `### ${func.name}<a name="${anchor}"></a>\n`;
-      details += `!!! function "${this.formatFunctionSignature(func)}"\n\n`;
-      details += `    ${this.formatDocumentation(func.documentation).replace(/\n/g, '\n    ')}\n\n`;
-    }
-    
-    return details;
-  }
-
-  private formatDocumentation(doc: DocumentationComment): string {
-    if (!doc.brief && !doc.detailed) return '';
-    
-    let formatted = '';
-    if (doc.brief) formatted += `@brief ${doc.brief}\n\n`;
-    if (doc.detailed) formatted += `${doc.detailed}\n\n`;
-    
-    return formatted;
-  }
-
-  private generateAnchor(name: string): string {
-    return name.toLowerCase().replace(/[^a-z0-9]/g, '-');
-  }
-
-  private getLanguageForSyntax(): string {
-    return 'cpp'; // Will be dynamic based on parser language
-  }
-
-  private formatFunctionSignature(func: ASTNode): string {
-    return func.signature || `${func.name}()`;
-  }
-
-  private generateModuleDescription(nodes: ASTNode[]): string {
-    const descriptions = nodes
-      .map(n => n.documentation.brief)
-      .filter(Boolean)
-      .slice(0, 2);
-    
-    return descriptions.join(' ') || 'Module containing various components and utilities.';
-  }
-}
-
-interface ModuleInfo {
-  name: string;
-  path: string;
-  classes: string[];
-  functions: string[];
-  submodules: string[];
-}
-```
-
-## Implementation Phases
-
-### Phase 1: Foundation (Week 1)
-1. **Project Integration**
-   - Update package.json with new dependencies
-   - Create parser directory structure under `src/lib/parser/`
-   - Add TypeScript types and interfaces
-   - Configure build system for new modules
-
-2. **Core Interfaces & Types**
-   - Define parser interface (src/lib/parser/core/interfaces.ts)
-   - Create AST node definitions (src/lib/parser/ast/nodes.ts)
-   - Implement base parser class (src/lib/parser/parsers/base-parser.ts)
-   - Add configuration management (src/lib/parser/core/config.ts)
-
-3. **Utility Components**
-   - File system utilities (src/lib/parser/utils/file-utils.ts)
-   - String processing helpers (src/lib/parser/utils/string-utils.ts)
-   - Markdown formatting utilities (src/lib/parser/utils/markdown-utils.ts)
-
-### Phase 2: C++ Parser (Week 2)
-1. **C++ Comment Parser**
-   - Detect and extract documentation comments (`/** */`, `///`, `//!`)
-   - Parse common documentation tags (`@brief`, `@param`, `@return`, etc.)
-   - Handle multi-line comments with proper formatting
-
-2. **C++ AST Builder**
-   - Parse class/struct definitions using regex patterns
-   - Extract function/method signatures
-   - Identify inheritance relationships
-   - Handle templates and namespaces
-
-3. **Integration Testing**
-   - Test with sample C++ files
-   - Verify AST structure correctness
-   - Validate comment extraction
-
-### Phase 3: CLI Integration (Week 3)
-1. **CLI Command Integration**
-   - Add parser commands to existing CLI (src/cli/parser-commands.ts)
-   - Integrate with existing commander.js structure
-   - Add configuration options and validation
-
-2. **New CLI Commands**
-   ```bash
-   docs-rag parse --language cpp --input ./src --output ./docs
-   docs-rag parse --config parser-config.json
-   docs-rag parse --watch --incremental
-   docs-rag parse --list-languages
-   ```
-
-3. **Configuration System**
-   - Parser-specific configuration (src/config/parser-config.ts)
-   - Integration with existing configuration pattern
-   - Support for project-specific parser settings
-
-### Phase 4: Documentation Generation (Week 4)
-1. **Markdown Output Generator**
-   - Replicate the structure from `/data/tui/docs`
-   - Generate index files with package references
-   - Create detailed class documentation pages
-   - Implement function detail sections
-
-2. **Output Structure**
-   ```
-   docs/
-   ├── index.md                    # Main index
-   ├── module1/
-   │   ├── index.md               # Module index
-   │   ├── Class1.md
-   │   ├── Class2.md
-   │   └── SubModule/
-   │       └── index.md
-   └── module2/
-       └── ...
-   ```
-
-3. **Integration with DocumentService**
-   - Extend DocumentService to handle parser-generated markdown
-   - Add parser output to existing RAG functionality
-   - Enable search across generated documentation
-
-### Phase 5: Advanced Features (Week 5-6)
-1. **Enhanced Comment Parsing**
-   - Support for custom comment tags
-   - Example code block extraction
-   - TODO/FIXME note extraction
-   - Version change detection
-
-2. **Quality Improvements**
-   - Cross-reference generation
-   - Inheritance diagrams (ASCII)
-   - Namespace/module organization
-   - Search-friendly indexing
-
-3. **Performance Optimization**
-   - Parallel file processing using worker threads
-   - Incremental parsing (only changed files)
-   - Memory-efficient AST building
-
-### Phase 6: Extensibility Framework (Week 7-8)
-1. **Plugin Architecture**
-   - Dynamic parser loading
-   - Configuration-driven language selection
-   - Custom output formatters
-
-2. **Future Language Support**
-   - Create interfaces for Python parser
-   - Design Java parser structure
-   - Document extension guidelines
-
-3. **Integration Enhancements**
-   - Integration with existing MCP server
-   - Add parser commands to MCP interface
-   - Enable programmatic parser usage via API
-
-## Detailed Implementation Plan
-
-### Package.json Updates
-
-```json
-{
-  "dependencies": {
-    "@types/node": "^24.10.1",
-    "commander": "^14.0.2",
-    "fs-extra": "^11.3.2",
-    "glob": "^13.0.0",
-    "typescript": "^5.9.3",
-    "zod": "^4.1.12",
-    "chokidar": "^4.0.1",           // For watch mode
-    "typescript-eslint-parser": "^6.0.0", // For future TS parsing
-    "@babel/parser": "^7.23.0",      // For future JS parsing
-    "acorn": "^8.11.0"               // For future JS parsing
-  },
-  "scripts": {
-    "build": "tsc",
-    "dev": "tsx src/cli/index.ts",
-    "parse": "node dist/cli/index.js parse",
-    "parse:dev": "tsx src/cli/index.ts parse"
-  }
-}
-```
-
-### C++ Parser Implementation (src/lib/parser/parsers/cpp-parser.ts)
-
-```typescript
-import { BaseParser } from './base-parser';
-import { ILanguageParser, ASTNode, DocumentationComment } from '../core/interfaces';
-import { FileUtils } from '../utils/file-utils';
-
-export class CppParser extends BaseParser implements ILanguageParser {
-  getLanguage(): string {
-    return 'cpp';
-  }
-
-  getFileExtensions(): string[] {
-    return ['.cpp', '.h', '.hpp', '.cxx', '.cc', '.c'];
-  }
-
-  canParse(filePath: string): boolean {
-    const ext = filePath.substring(filePath.lastIndexOf('.'));
-    return this.getFileExtensions().includes(ext);
-  }
-
-  async parseFile(filePath: string): Promise<ASTNode[]> {
-    const content = await FileUtils.readFile(filePath);
-    const lines = content.split('\n');
-    
-    // Extract comments first
-    const comments = this.extractComments(lines);
-    
-    // Parse code elements
-    const nodes = await this.parseCodeElements(lines, comments, filePath);
-    
-    return nodes;
-  }
-
-  private extractComments(lines: string[]): Map<number, DocumentationComment> {
-    const comments = new Map<number, DocumentationComment>();
-    
-    for (let i = 0; i < lines.length; i++) {
-      const line = lines[i];
-      const trimmed = line.trim();
-      
-      // Detect different comment types
-      if (trimmed.startsWith('/**')) {
-        const comment = this.parseBlockComment(lines, i);
-        if (comment) {
-          comments.set(i + 1, comment);
-          i += this.getCommentHeight(comment.rawContent) - 1;
-        }
-      } else if (trimmed.startsWith('///') || trimmed.startsWith('//!')) {
-        const comment = this.parseLineComment(lines, i);
-        if (comment) {
-          comments.set(i + 1, comment);
-        }
-      }
-    }
-    
-    return comments;
-  }
-
-  private parseBlockComment(lines: string[], startIndex: number): DocumentationComment | null {
-    let content = '';
-    let i = startIndex;
-    
-    // Find the end of the block comment
-    while (i < lines.length && !lines[i].includes('*/')) {
-      content += lines[i] + '\n';
-      i++;
-    }
-    if (i < lines.length) {
-      content += lines[i] + '\n';
-    }
-    
-    return this.parseCommentContent(content, 'doxyblock', startIndex + 1);
-  }
-
-  private parseLineComment(lines: string[], startIndex: number): DocumentationComment | null {
-    const line = lines[startIndex];
-    return this.parseCommentContent(line, 'doxline', startIndex + 1);
-  }
-
-  private parseCommentContent(rawContent: string, type: 'doxline' | 'doxyblock', line: number): DocumentationComment {
-    // Clean up the comment markers
-    const cleaned = rawContent
-      .replace(/\/\*\*|\/\*|\*\/|\/\/\/|\/\!/g, '')
-      .split('\n')
-      .map(line => line.trim().replace(/^\*\s?/, ''))
-      .join('\n')
-      .trim();
-
-    // Extract @tags
-    const tagRegex = /@(\w+)(?:\s+(.+?))?(?=\s+@|$)/gs;
-    const tags: { name: string; value: string }[] = [];
-    let tagMatch;
-    
-    while ((tagMatch = tagRegex.exec(cleaned)) !== null) {
-      tags.push({
-        name: tagMatch[1],
-        value: tagMatch[2]?.trim() || ''
-      });
-    }
-
-    // Extract brief (first sentence or first line before @tags)
-    const beforeTags = cleaned.split('@')[0].trim();
-    const brief = this.extractBrief(beforeTags);
-
-    return {
-      type,
-      rawContent,
-      brief,
-      detailed: beforeTags.substring(brief.length).trim(),
-      tags,
-      location: { filePath: '', line, column: 0 }
-    };
-  }
-
-  private extractBrief(text: string): string {
-    // Try to extract first sentence
-    const sentences = text.split(/[.!?]/);
-    if (sentences.length > 1 && sentences[0].length < 100) {
-      return sentences[0].trim() + '.';
-    }
-    
-    // Fall back to first line
-    const lines = text.split('\n');
-    return lines[0].trim() || text.substring(0, 80).trim();
-  }
-
-  private getCommentHeight(content: string): number {
-    return content.split('\n').length;
-  }
-
-  private async parseCodeElements(
-    lines: string[], 
-    comments: Map<number, DocumentationComment>, 
-    filePath: string
-  ): Promise<ASTNode[]> {
-    const nodes: ASTNode[] = [];
-    
-    for (let i = 0; i < lines.length; i++) {
-      const line = lines[i];
-      
-      // Parse classes
-      const classMatch = line.match(/^\s*(class|struct)\s+(\w+)/);
-      if (classMatch) {
-        const node = await this.parseClass(lines, i, comments, filePath);
-        if (node) {
-          nodes.push(node);
-        }
-      }
-      
-      // Parse functions
-      const functionMatch = line.match(/^\s*(?:\w+\s+)*(\w+)\s*\([^)]*\)\s*(?:\{|;)/);
-      if (functionMatch && !line.includes('class')) {
-        const node = await this.parseFunction(lines, i, comments, filePath);
-        if (node) {
-          nodes.push(node);
-        }
-      }
-    }
-    
-    return nodes;
-  }
-
-  private async parseClass(
-    lines: string[], 
-    startIndex: number,
-    comments: Map<number, DocumentationComment>,
-    filePath: string
-  ): Promise<ASTNode | null> {
-    const line = lines[startIndex];
-    const match = line.match(/^\s*(class|struct)\s+(\w+)/);
-    
-    if (!match) return null;
-    
-    const [, type, name] = match;
-    
-    // Find preceding comment
-    let comment = comments.get(startIndex);
-    if (!comment) {
-      comment = comments.get(startIndex - 1);
-    }
-    
-    return {
-      type: type as 'class' | 'struct',
-      name,
-      documentation: comment || this.emptyDocumentation(),
-      location: { filePath, line: startIndex + 1, column: 0 },
-      children: [],
-      isStruct: type === 'struct'
-    };
-  }
-
-  private async parseFunction(
-    lines: string[], 
-    startIndex: number,
-    comments: Map<number, DocumentationComment>,
-    filePath: string
-  ): Promise<ASTNode | null> {
-    const line = lines[startIndex];
-    const match = line.match(/^\s*(?:\w+\s+)*(\w+)\s*\([^)]*\)\s*(?:\{|;)/);
-    
-    if (!match) return null;
-    
-    const [, name] = match;
-    
-    // Find preceding comment
-    let comment = comments.get(startIndex);
-    if (!comment) {
-      comment = comments.get(startIndex - 1);
-    }
-    
-    return {
-      type: 'function',
-      name,
-      documentation: comment || this.emptyDocumentation(),
-      location: { filePath, line: startIndex + 1, column: 0 },
-      children: [],
-      signature: line.trim()
-    };
-  }
-
-  private emptyDocumentation(): DocumentationComment {
-    return {
-      type: 'unknown',
-      rawContent: '',
-      brief: '',
-      detailed: '',
-      tags: [],
-      location: { filePath: '', line: 0, column: 0 }
-    };
-  }
-}
-```
-
-### CLI Integration (src/cli/parser-commands.ts)
-
-```typescript
-#!/usr/bin/env node
-
-import { Command } from 'commander';
-import { ParseService } from '../services/parseService';
-import { existsSync } from 'fs';
-import { resolve } from 'path';
-
-const parseService = new ParseService();
-
-export const parserCommands = (program: Command) => {
-  program
-    .command('parse')
-    .description('Generate documentation from source code comments')
-    .requiredOption('-i, --input <path>', 'Input directory containing source files')
-    .requiredOption('-o, --output <path>', 'Output directory for generated documentation')
-    .option('-l, --languages <languages>', 'Comma-separated list of languages to parse', 'cpp')
-    .option('-c, --config <config>', 'Configuration file path')
-    .option('-w, --watch', 'Watch for file changes and regenerate', false)
-    .option('--incremental', 'Only process changed files', false)
-    .option('--include-private', 'Include private members', false)
-    .option('--dry-run', 'Show what would be parsed without generating files', false)
-    .action(async (options) => {
-      if (!existsSync(options.input)) {
-        console.error(`Error: Input directory '${options.input}' does not exist`);
-        process.exit(1);
-      }
-
-      try {
-        const result = await parseService.generateDocumentation({
-          inputPath: resolve(options.input),
-          outputPath: resolve(options.output),
-          languages: options.languages.split(',').map((l: string) => l.trim()),
-          configPath: options.config ? resolve(options.config) : undefined,
-          watch: options.watch,
-          incremental: options.incremental,
-          includePrivate: options.includePrivate,
-          dryRun: options.dryRun
-        });
-
-        if (options.dryRun) {
-          console.log('Dry run results:');
-          console.log(`  Files to process: ${result.filesToProcess.length}`);
-          console.log(`  Estimated output files: ${result.estimatedFiles}`);
-          result.filesToProcess.forEach(file => console.log(`    - ${file}`));
-        } else {
-          console.log(`Documentation generated successfully!`);
-          console.log(`  Processed ${result.processedFiles} files`);
-          console.log(`  Generated ${result.generatedFiles} documentation files`);
-          console.log(`  Output directory: ${options.output}`);
-          
-          if (result.errors.length > 0) {
-            console.log(`  Warnings/Errors: ${result.errors.length}`);
-            result.errors.forEach(error => console.log(`    - ${error}`));
-          }
-        }
-      } catch (error) {
-        console.error('Error:', error);
-        process.exit(1);
-      }
-    });
-
-  program
-    .command('parse-list-languages')
-    .description('List all supported parser languages')
-    .action(() => {
-      const languages = parseService.getSupportedLanguages();
-      console.log('Supported languages:');
-      languages.forEach(lang => {
-        console.log(`  ${lang.name}: ${lang.description}`);
-        console.log(`    Extensions: ${lang.extensions.join(', ')}`);
-        console.log();
-      });
-    });
-
-  program
-    .command('parse-validate')
-    .description('Validate configuration and source files')
-    .requiredOption('-i, --input <path>', 'Input directory to validate')
-    .option('-c, --config <config>', 'Configuration file to validate')
-    .action(async (options) => {
-      if (!existsSync(options.input)) {
-        console.error(`Error: Input directory '${options.input}' does not exist`);
-        process.exit(1);
-      }
-
-      try {
-        const validation = await parseService.validateConfiguration({
-          inputPath: resolve(options.input),
-          configPath: options.config ? resolve(options.config) : undefined
-        });
-
-        console.log('Validation results:');
-        console.log(`  Input directory: ${validation.inputValid ? '✓' : '✗'}`);
-        console.log(`  Configuration: ${validation.configValid ? '✓' : '✗'}`);
-        console.log(`  Supported files: ${validation.supportedFiles.length}`);
-        
-        if (validation.unsupportedFiles.length > 0) {
-          console.log(`  Unsupported files: ${validation.unsupportedFiles.length}`);
-          validation.unsupportedFiles.forEach(file => console.log(`    - ${file}`));
-        }
-        
-        if (validation.warnings.length > 0) {
-          console.log(`  Warnings: ${validation.warnings.length}`);
-          validation.warnings.forEach(warning => console.log(`    - ${warning}`));
-        }
-      } catch (error) {
-        console.error('Error:', error);
-        process.exit(1);
-      }
-    });
-};
-```
-
-### Parse Service (src/services/parseService.ts)
-
-```typescript
-import { 
-  ILanguageParser, 
-  DocumentationConfig, 
-  ParserConfig, 
-  ASTNode 
-} from '../lib/parser/core/interfaces';
-import { CppParser } from '../lib/parser/parsers/cpp-parser';
-import { DocumentationGenerator } from '../lib/parser/core/documentation-generator';
-import { FileUtils } from '../lib/parser/utils/file-utils';
-import { ConfigLoader } from '../lib/parser/core/config';
-import { chokidar } from 'chokidar';
-import { resolve, basename, extname } from 'path';
-
-interface ParseOptions {
-  inputPath: string;
-  outputPath: string;
-  languages: string[];
-  configPath?: string;
-  watch?: boolean;
-  incremental?: boolean;
-  includePrivate?: boolean;
-  dryRun?: boolean;
-}
-
-interface ParseResult {
-  processedFiles: number;
-  generatedFiles: number;
-  filesToProcess: string[];
-  errors: string[];
-  estimatedFiles: number;
-}
-
-interface ValidationResult {
-  inputValid: boolean;
-  configValid: boolean;
-  supportedFiles: string[];
-  unsupportedFiles: string[];
-  warnings: string[];
-}
-
-interface LanguageInfo {
-  name: string;
-  description: string;
-  extensions: string[];
-}
-
-export class ParseService {
-  private parsers: Map<string, ILanguageParser> = new Map();
-  private configLoader: ConfigLoader;
-
-  constructor() {
-    this.configLoader = new ConfigLoader();
-    this.registerDefaultParsers();
-  }
-
-  private registerDefaultParsers(): void {
-    this.parsers.set('cpp', new CppParser());
-    // Future: this.parsers.set('python', new PythonParser());
-    // Future: this.parsers.set('java', new JavaParser());
-  }
-
-  getSupportedLanguages(): LanguageInfo[] {
-    return Array.from(this.parsers.entries()).map(([key, parser]) => ({
-      name: key,
-      description: `${key.toUpperCase()} source code parser`,
-      extensions: parser.getFileExtensions()
-    }));
-  }
-
-  async generateDocumentation(options: ParseOptions): Promise<ParseResult> {
-    // Load configuration
-    const config = await this.loadConfiguration(options);
-    
-    // Find source files
-    const sourceFiles = await this.findSourceFiles(options.inputPath, options.languages);
-    
-    if (options.dryRun) {
-      return {
-        processedFiles: 0,
-        generatedFiles: 0,
-        filesToProcess: sourceFiles,
-        errors: [],
-        estimatedFiles: this.estimateOutputFiles(sourceFiles)
-      };
-    }
-
-    // Parse files
-    const nodes: ASTNode[] = [];
-    const errors: string[] = [];
-
-    for (const filePath of sourceFiles) {
-      try {
-        const fileNodes = await this.parseFile(filePath);
-        nodes.push(...fileNodes);
-      } catch (error) {
-        errors.push(`Failed to parse ${filePath}: ${error}`);
-      }
-    }
-
-    // Generate documentation
-    const generator = new DocumentationGenerator(config);
-    await generator.generate(nodes);
-
-    const generatedFiles = await this.countGeneratedFiles(config.outputDirectory);
-
-    return {
-      processedFiles: sourceFiles.length,
-      generatedFiles,
-      filesToProcess: sourceFiles,
-      errors
-    };
-  }
-
-  async validateConfiguration(options: {
-    inputPath: string;
-    configPath?: string;
-  }): Promise<ValidationResult> {
-    const inputValid = await FileUtils.exists(options.inputPath);
-    
-    let configValid = true;
-    let warnings: string[] = [];
-
-    try {
-      if (options.configPath) {
-        await this.configLoader.loadConfig(options.configPath);
-      }
-    } catch (error) {
-      configValid = false;
-      warnings.push(`Configuration error: ${error}`);
-    }
-
-    const allFiles = await FileUtils.getAllFiles(options.inputPath);
-    const supportedFiles = allFiles.filter(file => {
-      const ext = extname(file);
-      return Array.from(this.parsers.values()).some(parser => 
-        parser.getFileExtensions().includes(ext)
-      );
-    });
-
-    const unsupportedFiles = allFiles.filter(file => !supportedFiles.includes(file));
-
-    return {
-      inputValid,
-      configValid,
-      supportedFiles,
-      unsupportedFiles,
-      warnings
-    };
-  }
-
-  private async loadConfiguration(options: ParseOptions): Promise<DocumentationConfig> {
-    let config: DocumentationConfig;
-
-    if (options.configPath) {
-      config = await this.configLoader.loadConfig(options.configPath);
-    } else {
-      config = this.createDefaultConfig(options);
-    }
-
-    return config;
-  }
-
-  private createDefaultConfig(options: ParseOptions): DocumentationConfig {
-    return {
-      outputDirectory: options.outputPath,
-      indexTitle: 'Source Code Documentation',
-      generatorName: 'docs-rag-parser',
-      generateIndex: true,
-      generateModuleIndexes: true,
-      includePrivate: options.includePrivate || false,
-      includeSourceLinks: true,
-      sourceRootPath: options.inputPath,
-      theme: 'material'
-    };
-  }
-
-  private async findSourceFiles(inputPath: string, languages: string[]): Promise<string[]> {
-    const allFiles = await FileUtils.getAllFiles(inputPath);
-    
-    return allFiles.filter(file => {
-      const parser = this.getParserForFile(file);
-      return parser && languages.includes(parser.getLanguage());
-    });
-  }
-
-  private getParserForFile(filePath: string): ILanguageParser | null {
-    const ext = filePath.substring(filePath.lastIndexOf('.'));
-    
-    for (const parser of this.parsers.values()) {
-      if (parser.getFileExtensions().includes(ext)) {
-        return parser;
-      }
-    }
-    
-    return null;
-  }
-
-  private async parseFile(filePath: string): Promise<ASTNode[]> {
-    const parser = this.getParserForFile(filePath);
-    if (!parser) {
-      throw new Error(`No parser found for file: ${filePath}`);
-    }
-
-    return await parser.parseFile(filePath);
-  }
-
-  private estimateOutputFiles(sourceFiles: string[]): number {
-    // Rough estimation: one module index per unique file name + one per class/function
-    const uniqueNames = new Set(sourceFiles.map(file => 
-      basename(file).replace(/\.(cpp|h|hpp|cxx|cc|c)$/, '')
-    ));
-    return uniqueNames.size + Math.floor(sourceFiles.length * 2); // Estimated 2 items per file
-  }
-
-  private async countGeneratedFiles(outputDirectory: string): Promise<number> {
-    try {
-      const files = await FileUtils.getAllFiles(outputDirectory);
-      return files.filter(file => file.endsWith('.md')).length;
-    } catch {
-      return 0;
-    }
-  }
-}
-```
-
-### Update Main CLI (src/cli/index.ts)
-
-```typescript
-#!/usr/bin/env node
-
-import { Command } from 'commander';
-import { DocumentService } from '../services/documentService';
-import { existsSync } from 'fs';
-import { parserCommands } from './parser-commands';
-
-const program = new Command();
-const documentService = new DocumentService();
-
-program
-  .name('docs-rag')
-  .description('CLI tool for managing markdown documents in Qdrant and parsing source code')
-  .version('1.0.0');
-
-// Existing commands...
-// ... (keep all existing commands)
-
-// Add parser commands
-parserCommands(program);
-
-program.parse();
-```
-
-## Success Criteria
-
-1. **Functional Requirements**
-   - Parse C++ files with 95% comment extraction accuracy
-   - Generate documentation matching `/data/tui/docs` format
-   - Process projects with 1000+ files efficiently
-   - Support incremental rebuilds
-
-2. **Integration Requirements**
-   - Seamlessly integrate into existing CLI structure
-   - Follow existing TypeScript patterns and conventions
-   - Use existing dependencies where possible
-   - Maintain compatibility with existing commands
-
-3. **Quality Requirements**
-   - Produce syntactically correct Markdown
-   - Generate cross-references between modules
-   - Handle complex C++ constructs (templates, namespaces)
-   - Maintain source code privacy (no code leakage in docs)
-
-## Future Enhancements
-
-### Short Term (Next 3 months)
-- Python language parser
-- Integration with DocumentService for RAG
-- HTML documentation output
-- Enhanced watch mode with better performance
-
-### Long Term (6-12 months)
-- Multi-language project support
-- Interactive documentation web UI
-- AI-powered comment generation suggestions
-- Integration with CI/CD pipelines
-- Documentation quality scoring
-
-This updated plan fully integrates the source code parser into the existing TypeScript project while following the established patterns and conventions.

+ 0 - 607
quick-start-implementation.md

@@ -1,607 +0,0 @@
-# Quick Start Implementation Guide
-
-## Project Setup Commands
-
-```bash
-# Create project structure
-mkdir docs-parser && cd docs-parser
-mkdir -p src/{core,parsers,ast,utils} include tests examples config docs
-
-# Initialize CMake project
-cat > CMakeLists.txt << 'EOF'
-cmake_minimum_required(VERSION 3.16)
-project(DocsParser VERSION 1.0.0 LANGUAGES CXX)
-
-set(CMAKE_CXX_STANDARD 20)
-set(CMAKE_CXX_STANDARD_REQUIRED ON)
-
-# Include directories
-include_directories(include)
-
-# Find required packages
-find_package(GTest REQUIRED)
-
-# Add subdirectories
-add_subdirectory(src)
-add_subdirectory(tests)
-
-enable_testing()
-EOF
-
-# Create src CMakeLists.txt
-cat > src/CMakeLists.txt << 'EOF'
-# Core library sources
-set(CORE_SOURCES
-    core/parser_interface.cpp
-    core/documentation_generator.cpp
-    core/comment_parser.cpp
-    core/config.cpp
-)
-
-# AST sources
-set(AST_SOURCES
-    ast/ast_nodes.cpp
-    ast/visitor.cpp
-)
-
-# Parser sources
-set(PARSER_SOURCES
-    parsers/cpp_parser.cpp
-)
-
-# Utility sources
-set(UTIL_SOURCES
-    utils/file_utils.cpp
-    utils/string_utils.cpp
-    utils/markdown_utils.cpp
-)
-
-# Create static library
-add_library(docs_parser_lib
-    ${CORE_SOURCES}
-    ${AST_SOURCES}
-    ${PARSER_SOURCES}
-    ${UTIL_SOURCES}
-)
-
-target_include_directories(docs_parser_lib PUBLIC include)
-
-# Link required libraries
-target_link_libraries(docs_parser_lib PRIVATE GTest::gtest)
-
-# Create main executable
-add_executable(docs_parser main.cpp)
-target_link_libraries(docs_parser docs_parser_lib)
-EOF
-
-# Create tests CMakeLists.txt
-cat > tests/CMakeLists.txt << 'EOF'
-# Test sources
-file(GLOB_RECURSE TEST_SOURCES "*.cpp")
-
-# Create test executable
-add_executable(run_tests ${TEST_SOURCES})
-target_link_libraries(run_tests docs_parser_lib GTest::gtest_main GTest::gtest)
-
-# Register tests
-add_test(NAME AllTests COMMAND run_tests)
-EOF
-```
-
-## Core Implementation Files
-
-### 1. Core Interface (`include/parser_interface.h`)
-
-```cpp
-#pragma once
-
-#include <memory>
-#include <vector>
-#include <string>
-
-struct SourceLocation {
-    std::string filePath;
-    int line = 0;
-    int column = 0;
-};
-
-class ASTNode {
-public:
-    enum class NodeType { CLASS, FUNCTION, NAMESPACE, UNKNOWN };
-    
-    virtual ~ASTNode() = default;
-    virtual NodeType getType() const = 0;
-    virtual std::string getName() const = 0;
-    virtual std::string getDocumentation() const = 0;
-    virtual SourceLocation getLocation() const = 0;
-};
-
-class ILanguageParser {
-public:
-    virtual ~ILanguageParser() = default;
-    virtual std::vector<std::unique_ptr<ASTNode>> parseFile(const std::string& filePath) = 0;
-    virtual std::string getLanguage() const = 0;
-    virtual std::vector<std::string> getFileExtensions() const = 0;
-    virtual bool canParse(const std::string& filePath) const = 0;
-};
-```
-
-### 2. Simple C++ Parser (`src/parsers/cpp_parser.cpp`)
-
-```cpp
-#include "parser_interface.h"
-#include <regex>
-#include <fstream>
-#include <sstream>
-
-class SimpleClassNode : public ASTNode {
-private:
-    std::string name;
-    std::string documentation;
-    SourceLocation location;
-    std::vector<std::unique_ptr<ASTNode>> children;
-    
-public:
-    SimpleClassNode(const std::string& n, const std::string& doc, SourceLocation loc)
-        : name(n), documentation(doc), location(loc) {}
-    
-    NodeType getType() const override { return NodeType::CLASS; }
-    std::string getName() const override { return name; }
-    std::string getDocumentation() const override { return documentation; }
-    SourceLocation getLocation() const override { return location; }
-    
-    void addChild(std::unique_ptr<ASTNode> child) {
-        children.push_back(std::move(child));
-    }
-};
-
-class SimpleFunctionNode : public ASTNode {
-private:
-    std::string name;
-    std::string documentation;
-    std::string signature;
-    SourceLocation location;
-    
-public:
-    SimpleFunctionNode(const std::string& n, const std::string& doc, 
-                      const std::string& sig, SourceLocation loc)
-        : name(n), documentation(doc), signature(sig), location(loc) {}
-    
-    NodeType getType() const override { return NodeType::FUNCTION; }
-    std::string getName() const override { return name; }
-    std::string getDocumentation() const override { return documentation; }
-    SourceLocation getLocation() const override { return location; }
-    
-    const std::string& getSignature() const { return signature; }
-};
-
-class CppParser : public ILanguageParser {
-public:
-    std::vector<std::unique_ptr<ASTNode>> parseFile(const std::string& filePath) override {
-        std::vector<std::unique_ptr<ASTNode>> nodes;
-        
-        std::ifstream file(filePath);
-        if (!file.is_open()) return nodes;
-        
-        std::string content((std::istreambuf_iterator<char>(file)),
-                           std::istreambuf_iterator<char>());
-        
-        // Extract comments first
-        std::map<int, std::string> comments;
-        extractComments(content, comments);
-        
-        // Simple regex parsing for classes and functions
-        parseClasses(content, comments, nodes, filePath);
-        parseFunctions(content, comments, nodes, filePath);
-        
-        return nodes;
-    }
-    
-    std::string getLanguage() const override { return "cpp"; }
-    
-    std::vector<std::string> getFileExtensions() const override {
-        return {".cpp", ".h", ".hpp", ".cxx", ".cc", ".c"};
-    }
-    
-    bool canParse(const std::string& filePath) const override {
-        std::string ext = filePath.substr(filePath.find_last_of('.'));
-        auto extensions = getFileExtensions();
-        return std::find(extensions.begin(), extensions.end(), ext) != extensions.end();
-    }
-    
-private:
-    void extractComments(const std::string& content, std::map<int, std::string>& comments) {
-        std::regex commentRegex(R"((/\*\*.*?\*/|///.*?$|//!.*?$))", std::regex::dotall);
-        std::sregex_iterator iter(content.begin(), content.end(), commentRegex);
-        std::sregex_iterator end;
-        
-        std::istringstream stream(content);
-        std::string line;
-        int lineNum = 0;
-        
-        while (std::getline(stream, line)) {
-            lineNum++;
-            for (auto it = iter; it != end; ++it) {
-                std::smatch match = *it;
-                if (match.position() < line.length() + stream.tellg()) {
-                    std::string comment = match.str();
-                    if (comment.find("/**") == 0 || comment.find("///") == 0 || comment.find("//!") == 0) {
-                        // Clean up comment
-                        std::string clean = std::regex_replace(comment, std::regex(R"(/\*\*|\*/|///|//!|\*)"), "");
-                        clean = std::regex_replace(clean, std::regex(R"(^\s+)"), "");
-                        comments[lineNum] = clean;
-                    }
-                }
-            }
-        }
-    }
-    
-    void parseClasses(const std::string& content, const std::map<int, std::string>& comments,
-                     std::vector<std::unique_ptr<ASTNode>>& nodes, const std::string& filePath) {
-        std::regex classRegex(R"(class\s+(\w+)[^{]*\{)");
-        std::sregex_iterator iter(content.begin(), content.end(), classRegex);
-        std::sregex_iterator end;
-        
-        for (auto it = iter; it != end; ++it) {
-            std::smatch match = *it;
-            std::string className = match[1].str();
-            
-            // Find line number
-            std::string before = content.substr(0, match.position());
-            int line = std::count(before.begin(), before.end(), '\n') + 1;
-            
-            // Find preceding comment
-            std::string doc;
-            auto commentIt = comments.find(line - 1);
-            if (commentIt != comments.end()) {
-                doc = commentIt->second;
-            }
-            
-            SourceLocation loc{filePath, line};
-            nodes.push_back(std::make_unique<SimpleClassNode>(className, doc, loc));
-        }
-    }
-    
-    void parseFunctions(const std::string& content, const std::map<int, std::string>& comments,
-                       std::vector<std::unique_ptr<ASTNode>>& nodes, const std::string& filePath) {
-        std::regex functionRegex(R"((\w+\s+)*(\w+)\s*\([^)]*\)\s*(?:\{|;))");
-        std::sregex_iterator iter(content.begin(), content.end(), functionRegex);
-        std::sregex_iterator end;
-        
-        for (auto it = iter; it != end; ++it) {
-            std::smatch match = *it;
-            std::string functionName = match[2].str();
-            std::string signature = match.str();
-            
-            // Skip class definitions
-            if (signature.find("class ") == 0) continue;
-            
-            // Find line number
-            std::string before = content.substr(0, match.position());
-            int line = std::count(before.begin(), before.end(), '\n') + 1;
-            
-            // Find preceding comment
-            std::string doc;
-            auto commentIt = comments.find(line - 1);
-            if (commentIt != comments.end()) {
-                doc = commentIt->second;
-            }
-            
-            SourceLocation loc{filePath, line};
-            nodes.push_back(std::make_unique<SimpleFunctionNode>(functionName, doc, signature, loc));
-        }
-    }
-};
-```
-
-### 3. Documentation Generator (`src/core/documentation_generator.cpp`)
-
-```cpp
-#include "parser_interface.h"
-#include <fstream>
-#include <filesystem>
-#include <iostream>
-
-struct DocumentationConfig {
-    std::string outputDirectory = "docs";
-    std::string indexTitle = "Documentation";
-    std::string generatorName = "docs-parser";
-};
-
-class DocumentationGenerator {
-private:
-    DocumentationConfig config;
-    std::string currentContent;
-    
-public:
-    explicit DocumentationGenerator(const DocumentationConfig& cfg) : config(cfg) {}
-    
-    void generate(const std::vector<std::unique_ptr<ASTNode>>& nodes) {
-        // Create output directory
-        std::filesystem::create_directories(config.outputDirectory);
-        
-        // Generate main index
-        generateIndex(nodes);
-        
-        // Generate individual files for classes
-        generateClassFiles(nodes);
-        
-        // Generate module organization
-        generateModuleStructure(nodes);
-    }
-    
-private:
-    void generateIndex(const std::vector<std::unique_ptr<ASTNode>>& nodes) {
-        std::string content = R"(---
-generator: )" + config.generatorName + R"(---
-
-# )" + config.indexTitle + R"(
-
-)";
-        
-        content += generateModuleList(nodes);
-        
-        std::ofstream indexFile(config.outputDirectory + "/index.md");
-        indexFile << content;
-        indexFile.close();
-    }
-    
-    std::string generateModuleList(const std::vector<std::unique_ptr<ASTNode>>& nodes) {
-        std::stringstream ss;
-        
-        // Group classes and functions
-        std::vector<ASTNode*> classes;
-        std::vector<ASTNode*> functions;
-        
-        for (const auto& node : nodes) {
-            if (node->getType() == ASTNode::NodeType::CLASS) {
-                classes.push_back(node.get());
-            } else if (node->getType() == ASTNode::NodeType::FUNCTION) {
-                functions.push_back(node.get());
-            }
-        }
-        
-        if (!classes.empty()) {
-            ss << "## Classes\n\n";
-            for (const auto* cls : classes) {
-                ss << "- [" << cls->getName() << "](" << cls->getName() << ".md)";
-                if (!cls->getDocumentation().empty()) {
-                    ss << " - " << extractBrief(cls->getDocumentation());
-                }
-                ss << "\n";
-            }
-            ss << "\n";
-        }
-        
-        if (!functions.empty()) {
-            ss << "## Functions\n\n";
-            for (const auto* func : functions) {
-                ss << "- [" << func->getName() << "](" << func->getName() << ".md)";
-                if (!func->getDocumentation().empty()) {
-                    ss << " - " << extractBrief(func->getDocumentation());
-                }
-                ss << "\n";
-            }
-            ss << "\n";
-        }
-        
-        return ss.str();
-    }
-    
-    void generateClassFiles(const std::vector<std::unique_ptr<ASTNode>>& nodes) {
-        for (const auto& node : nodes) {
-            if (node->getType() == ASTNode::NodeType::CLASS) {
-                generateClassFile(static_cast<SimpleClassNode*>(node.get()));
-            } else if (node->getType() == ASTNode::NodeType::FUNCTION) {
-                generateFunctionFile(static_cast<SimpleFunctionNode*>(node.get()));
-            }
-        }
-    }
-    
-    void generateClassFile(const SimpleClassNode* classNode) {
-        std::string filename = config.outputDirectory + "/" + classNode->getName() + ".md";
-        std::ofstream file(filename);
-        
-        file << R"(---
-generator: )" << config.generatorName << R"(---
-
-# )" << classNode->getName() << R"(
-
-**class )" << classNode->getName() << R"(**
-
-)";
-        
-        if (!classNode->getDocumentation().empty()) {
-            file << formatDocumentation(classNode->getDocumentation()) << "\n\n";
-        }
-        
-        file << "## Source Location\n\n";
-        file << "File: `" << classNode->getLocation().filePath;
-        file << "`:" << classNode->getLocation().line << "\n\n";
-        
-        file.close();
-    }
-    
-    void generateFunctionFile(const SimpleFunctionNode* funcNode) {
-        std::string filename = config.outputDirectory + "/" + funcNode->getName() + ".md";
-        std::ofstream file(filename);
-        
-        file << R"(---
-generator: )" << config.generatorName << R"(---
-
-# )" << funcNode->getName() << R"(
-
-**function )" << funcNode->getName() << R"(**
-
-)";
-        
-        if (!funcNode->getDocumentation().empty()) {
-            file << formatDocumentation(funcNode->getDocumentation()) << "\n\n";
-        }
-        
-        file << "## Signature\n\n";
-        file << "```cpp\n" << funcNode->getSignature() << "\n```\n\n";
-        
-        file << "## Source Location\n\n";
-        file << "File: `" << funcNode->getLocation().filePath;
-        file << "`:" << funcNode->getLocation().line << "\n\n";
-        
-        file.close();
-    }
-    
-    void generateModuleStructure(const std::vector<std::unique_ptr<ASTNode>>& nodes) {
-        // For now, just put everything in the root directory
-        // Later we'll organize this into subdirectories based on namespaces
-    }
-    
-    std::string extractBrief(const std::string& doc) {
-        // Extract first sentence as brief description
-        size_t pos = doc.find('.');
-        if (pos != std::string::npos && pos < 100) {
-            return doc.substr(0, pos + 1);
-        }
-        return doc.length() > 80 ? doc.substr(0, 77) + "..." : doc;
-    }
-    
-    std::string formatDocumentation(const std::string& doc) {
-        std::string formatted = doc;
-        
-        // Replace @brief and similar tags
-        formatted = std::regex_replace(formatted, std::regex(R"(@brief\s+)"), "");
-        
-        // Format paragraphs
-        formatted = std::regex_replace(formatted, std::regex(R"(\n\s*\n)"), "\n\n");
-        
-        return formatted;
-    }
-};
-```
-
-### 4. Main Application (`main.cpp`)
-
-```cpp
-#include "parser_interface.h"
-#include <iostream>
-#include <filesystem>
-#include <vector>
-
-// Forward declarations
-std::unique_ptr<ILanguageParser> createCppParser();
-
-int main(int argc, char* argv[]) {
-    if (argc < 2) {
-        std::cerr << "Usage: docs-parser <input-path> [output-path]" << std::endl;
-        return 1;
-    }
-    
-    std::string inputPath = argv[1];
-    std::string outputPath = argc > 2 ? argv[2] : "docs";
-    
-    // Configuration
-    DocumentationConfig config;
-    config.outputDirectory = outputPath;
-    config.indexTitle = "Source Code Documentation";
-    config.generatorName = "docs-parser";
-    
-    // Create parser
-    auto parser = createCppParser();
-    
-    // Find source files
-    std::vector<std::string> sourceFiles;
-    for (const auto& entry : std::filesystem::recursive_directory_iterator(inputPath)) {
-        if (entry.is_regular_file() && parser->canParse(entry.path().string())) {
-            sourceFiles.push_back(entry.path().string());
-        }
-    }
-    
-    std::cout << "Found " << sourceFiles.size() << " source files" << std::endl;
-    
-    // Parse all files
-    std::vector<std::unique_ptr<ASTNode>> allNodes;
-    for (const auto& file : sourceFiles) {
-        std::cout << "Parsing: " << file << std::endl;
-        auto nodes = parser->parseFile(file);
-        for (auto& node : nodes) {
-            allNodes.push_back(std::move(node));
-        }
-    }
-    
-    std::cout << "Found " << allNodes.size() << " code elements" << std::endl;
-    
-    // Generate documentation
-    DocumentationGenerator generator(config);
-    generator.generate(allNodes);
-    
-    std::cout << "Documentation generated in: " << outputPath << std::endl;
-    return 0;
-}
-
-// Factory function
-std::unique_ptr<ILanguageParser> createCppParser() {
-    return std::make_unique<CppParser>();
-}
-```
-
-## Build and Run Instructions
-
-```bash
-# Build the project
-mkdir build && cd build
-cmake ..
-make
-
-# Run on example C++ code
-./docs_parser /path/to/cpp/source ./output/docs
-
-# Test on the TUI project
-./docs_parser /data/tui/src ./tui-docs
-```
-
-## Test Example File
-
-Create `test_example.cpp`:
-
-```cpp
-#include <iostream>
-
-/**
- * @brief A simple calculator class
- * This class provides basic arithmetic operations.
- */
-class Calculator {
-public:
-    /// @brief Add two numbers
-    int add(int a, int b);
-    
-    /**
-     * @brief Multiply two numbers
-     * @param a First number
-     * @param b Second number
-     * @return Product of a and b
-     */
-    int multiply(int a, int b);
-};
-
-/**
- * @brief Global utility function
- * This function demonstrates global documentation.
- */
-void utilityFunction() {
-    std::cout << "Utility function called" << std::endl;
-}
-```
-
-Run the parser:
-```bash
-./docs_parser . ./test-docs
-```
-
-Expected output structure:
-```
-test-docs/
-├── index.md
-├── Calculator.md
-└── utilityFunction.md
-```
-
-This minimal implementation provides a working foundation that can be extended with more sophisticated parsing, better documentation extraction, and enhanced formatting to match the exact style of the `/data/tui/docs` structure.

+ 0 - 572
technical-specification.md

@@ -1,572 +0,0 @@
-# Dynamic Source Code Parser - Technical Specification
-
-## Core Interfaces
-
-### Parser Interface
-```cpp
-// parser_interface.h
-#pragma once
-
-#include <memory>
-#include <vector>
-#include <string>
-
-// Forward declarations
-class ASTNode;
-struct SourceLocation;
-
-/**
- * @brief Interface for language-specific parsers
- * 
- * Each language parser implements this interface to provide
- * language-agnostic access to parsed source code structures.
- */
-class ILanguageParser {
-public:
-    virtual ~ILanguageParser() = default;
-    
-    /**
-     * @brief Parse a single source file and return AST nodes
-     * @param filePath Path to the source file
-     * @return Vector of AST nodes representing the file contents
-     */
-    virtual std::vector<std::unique_ptr<ASTNode>> parseFile(const std::string& filePath) = 0;
-    
-    /**
-     * @brief Get the programming language name
-     * @return String identifier for the language
-     */
-    virtual std::string getLanguage() const = 0;
-    
-    /**
-     * @brief Get file extensions supported by this parser
-     * @return Vector of file extensions (e.g., {".cpp", ".h", ".hpp"})
-     */
-    virtual std::vector<std::string> getFileExtensions() const = 0;
-    
-    /**
-     * @brief Check if a file can be parsed by this parser
-     * @param filePath Path to check
-     * @return true if the file extension is supported
-     */
-    virtual bool canParse(const std::string& filePath) const = 0;
-};
-```
-
-### AST Node Hierarchy
-```cpp
-// ast_nodes.h
-#pragma once
-
-#include <string>
-#include <vector>
-#include <memory>
-#include <optional>
-
-/**
- * @brief Source code location information
- */
-struct SourceLocation {
-    std::string filePath;
-    int line = 0;
-    int column = 0;
-    int endLine = 0;
-    int endColumn = 0;
-};
-
-/**
- * @brief Documentation comment with tags
- */
-struct DocumentationComment {
-    enum class Type {
-        DOXYLINE,    /// < line comment
-        DOXYBLOCK,   /** */ block comment
-        JAVADOC,     /** JavaDoc style */
-        UNKNOWN
-    };
-    
-    Type type = Type::UNKNOWN;
-    std::string rawContent;
-    std::string brief;
-    std::string detailed;
-    std::vector<std::string> tags;  // @param, @return, @brief, etc.
-    SourceLocation location;
-};
-
-/**
- * @brief Base class for all AST nodes
- */
-class ASTNode {
-public:
-    enum class NodeType {
-        NAMESPACE,
-        CLASS,
-        STRUCT,
-        FUNCTION,
-        METHOD,
-        VARIABLE,
-        ENUM,
-        ENUM_VALUE,
-        TEMPLATE,
-        MODULE,
-        UNKNOWN
-    };
-    
-protected:
-    NodeType nodeType;
-    std::string name;
-    DocumentationComment documentation;
-    SourceLocation location;
-    std::vector<std::unique_ptr<ASTNode>> children;
-    
-public:
-    explicit ASTNode(NodeType type) : nodeType(type) {}
-    virtual ~ASTNode() = default;
-    
-    // Getters
-    NodeType getType() const { return nodeType; }
-    const std::string& getName() const { return name; }
-    const DocumentationComment& getDocumentation() const { return documentation; }
-    const SourceLocation& getLocation() const { return location; }
-    const std::vector<std::unique_ptr<ASTNode>>& getChildren() const { return children; }
-    
-    // Setters
-    void setName(const std::string& n) { name = n; }
-    void setDocumentation(const DocumentationComment& doc) { documentation = doc; }
-    void setLocation(const SourceLocation& loc) { location = loc; }
-    
-    // Child management
-    void addChild(std::unique_ptr<ASTNode> child) { children.push_back(std::move(child)); }
-    
-    // Visitor pattern support
-    virtual void accept(class ASTVisitor& visitor) = 0;
-};
-
-/**
- * @brief Namespace or module node
- */
-class NamespaceNode : public ASTNode {
-public:
-    NamespaceNode() : ASTNode(NodeType::NAMESPACE) {}
-    void accept(ASTVisitor& visitor) override;
-};
-
-/**
- * @brief Class or struct definition
- */
-class ClassNode : public ASTNode {
-private:
-    bool isStruct = false;
-    std::vector<std::string> baseClasses;
-    std::vector<std::string> templateParameters;
-    std::string accessSpecifier;  // public, protected, private
-    
-public:
-    ClassNode() : ASTNode(NodeType::CLASS) {}
-    
-    bool getIsStruct() const { return isStruct; }
-    void setIsStruct(bool s) { isStruct = s; }
-    
-    const std::vector<std::string>& getBaseClasses() const { return baseClasses; }
-    void addBaseClass(const std::string& base) { baseClasses.push_back(base); }
-    
-    const std::vector<std::string>& getTemplateParameters() const { return templateParameters; }
-    void addTemplateParameter(const std::string& param) { templateParameters.push_back(param); }
-    
-    const std::string& getAccessSpecifier() const { return accessSpecifier; }
-    void setAccessSpecifier(const std::string& access) { accessSpecifier = access; }
-    
-    void accept(ASTVisitor& visitor) override;
-};
-
-/**
- * @brief Function or method parameter
- */
-struct Parameter {
-    std::string type;
-    std::string name;
-    std::string defaultValue;
-    DocumentationComment documentation;
-};
-
-/**
- * @brief Function or method definition
- */
-class FunctionNode : public ASTNode {
-private:
-    std::string returnType;
-    std::vector<Parameter> parameters;
-    bool isStatic = false;
-    bool isVirtual = false;
-    bool isConst = false;
-    bool isConstructor = false;
-    bool isDestructor = false;
-    std::string accessSpecifier;
-    
-public:
-    FunctionNode() : ASTNode(NodeType::FUNCTION) {}
-    
-    const std::string& getReturnType() const { return returnType; }
-    void setReturnType(const std::string& type) { returnType = type; }
-    
-    const std::vector<Parameter>& getParameters() const { return parameters; }
-    void addParameter(const Parameter& param) { parameters.push_back(param); }
-    
-    bool getIsStatic() const { return isStatic; }
-    void setIsStatic(bool s) { isStatic = s; }
-    
-    bool getIsVirtual() const { return isVirtual; }
-    void setIsVirtual(bool v) { isVirtual = v; }
-    
-    bool getIsConst() const { return isConst; }
-    void setIsConst(bool c) { isConst = c; }
-    
-    bool getIsConstructor() const { return isConstructor; }
-    void setIsConstructor(bool c) { isConstructor = c; }
-    
-    bool getIsDestructor() const { return isDestructor; }
-    void setIsDestructor(bool d) { isDestructor = d; }
-    
-    const std::string& getAccessSpecifier() const { return accessSpecifier; }
-    void setAccessSpecifier(const std::string& access) { accessSpecifier = access; }
-    
-    void accept(ASTVisitor& visitor) override;
-};
-
-/**
- * @brief Variable or field declaration
- */
-class VariableNode : public ASTNode {
-private:
-    std::string type;
-    std::string defaultValue;
-    bool isStatic = false;
-    bool isConst = false;
-    std::string accessSpecifier;
-    
-public:
-    VariableNode() : ASTNode(NodeType::VARIABLE) {}
-    
-    const std::string& getType() const { return type; }
-    void setType(const std::string& t) { type = t; }
-    
-    const std::string& getDefaultValue() const { return defaultValue; }
-    void setDefaultValue(const std::string& value) { defaultValue = value; }
-    
-    bool getIsStatic() const { return isStatic; }
-    void setIsStatic(bool s) { isStatic = s; }
-    
-    bool getIsConst() const { return isConst; }
-    void setIsConst(bool c) { isConst = c; }
-    
-    const std::string& getAccessSpecifier() const { return accessSpecifier; }
-    void setAccessSpecifier(const std::string& access) { accessSpecifier = access; }
-    
-    void accept(ASTVisitor& visitor) override;
-};
-
-/**
- * @brief Enum definition
- */
-class EnumNode : public ASTNode {
-private:
-    bool isEnumClass = false;
-    std::string underlyingType;
-    std::vector<std::pair<std::string, std::string>> values; // name, value
-    
-public:
-    EnumNode() : ASTNode(NodeType::ENUM) {}
-    
-    bool getIsEnumClass() const { return isEnumClass; }
-    void setIsEnumClass(bool e) { isEnumClass = e; }
-    
-    const std::string& getUnderlyingType() const { return underlyingType; }
-    void setUnderlyingType(const std::string& type) { underlyingType = type; }
-    
-    const std::vector<std::pair<std::string, std::string>>& getValues() const { return values; }
-    void addValue(const std::string& name, const std::string& value = "") {
-        values.emplace_back(name, value);
-    }
-    
-    void accept(ASTVisitor& visitor) override;
-};
-```
-
-### Visitor Pattern Implementation
-```cpp
-// visitor.h
-#pragma once
-
-#include "ast_nodes.h"
-
-/**
- * @brief Visitor interface for AST traversal
- */
-class ASTVisitor {
-public:
-    virtual ~ASTVisitor() = default;
-    
-    // Node visitors
-    virtual void visit(NamespaceNode& node) = 0;
-    virtual void visit(ClassNode& node) = 0;
-    virtual void visit(FunctionNode& node) = 0;
-    virtual void visit(VariableNode& node) = 0;
-    virtual void visit(EnumNode& node) = 0;
-    
-    // Default traversal behavior
-    virtual void traverse(ASTNode& node) {
-        for (auto& child : node.getChildren()) {
-            child->accept(*this);
-        }
-    }
-};
-
-// Visitor method implementations
-inline void NamespaceNode::accept(ASTVisitor& visitor) {
-    visitor.visit(*this);
-    visitor.traverse(*this);
-}
-
-inline void ClassNode::accept(ASTVisitor& visitor) {
-    visitor.visit(*this);
-    visitor.traverse(*this);
-}
-
-inline void FunctionNode::accept(ASTVisitor& visitor) {
-    visitor.visit(*this);
-    visitor.traverse(*this);
-}
-
-inline void VariableNode::accept(ASTVisitor& visitor) {
-    visitor.visit(*this);
-    visitor.traverse(*this);
-}
-
-inline void EnumNode::accept(ASTVisitor& visitor) {
-    visitor.visit(*this);
-    visitor.traverse(*this);
-}
-```
-
-### Documentation Generator
-```cpp
-// documentation_generator.h
-#pragma once
-
-#include "ast_nodes.h"
-#include "visitor.h"
-#include <string>
-#include <vector>
-#include <fstream>
-#include <filesystem>
-
-/**
- * @brief Configuration for documentation generation
- */
-struct DocumentationConfig {
-    std::string outputDirectory = "docs";
-    std::string indexTitle = "Documentation";
-    std::string generatorName = "docs-parser";
-    bool generateIndex = true;
-    bool generateModuleIndexes = true;
-    bool includePrivate = false;
-    bool includeSourceLinks = false;
-    std::string sourceRootPath;
-    std::string theme = "material";  // material, github, etc.
-};
-
-/**
- * @brief Markdown documentation generator
- */
-class DocumentationGenerator : public ASTVisitor {
-private:
-    DocumentationConfig config;
-    std::filesystem::path outputPath;
-    std::vector<std::string> moduleStack;
-    std::ofstream currentFile;
-    std::string currentContent;
-    
-    struct ModuleInfo {
-        std::string name;
-        std::string path;
-        std::vector<std::string> classes;
-        std::vector<std::string> functions;
-        std::vector<std::string> submodules;
-    };
-    
-    std::vector<ModuleInfo> modules;
-    
-public:
-    explicit DocumentationGenerator(const DocumentationConfig& cfg);
-    
-    /**
-     * @brief Generate documentation from parsed AST
-     * @param nodes Root AST nodes from parser
-     */
-    void generate(const std::vector<std::unique_ptr<ASTNode>>& nodes);
-    
-    // Visitor methods
-    void visit(NamespaceNode& node) override;
-    void visit(ClassNode& node) override;
-    void visit(FunctionNode& node) override;
-    void visit(VariableNode& node) override;
-    void visit(EnumNode& node) override;
-    
-private:
-    // File operations
-    void createDirectoryStructure();
-    void openFile(const std::filesystem::path& filePath);
-    void closeFile();
-    void writeContent(const std::string& content);
-    
-    // Generation methods
-    void generateIndex(const std::vector<std::unique_ptr<ASTNode>>& nodes);
-    void generateModuleIndexes();
-    void generateClassFile(ClassNode& classNode);
-    void generateNamespaceFile(NamespaceNode& namespaceNode);
-    
-    // Content formatting
-    std::string generateFunctionTable(const std::vector<FunctionNode*>& functions);
-    std::string generateFunctionDetails(const std::vector<FunctionNode*>& functions);
-    std::string generateClassHeader(ClassNode& classNode);
-    std::string generateInheritanceDiagram(ClassNode& classNode);
-    std::string formatDocumentation(const DocumentationComment& doc);
-    std::string formatParameters(const std::vector<Parameter>& params);
-    std::string escapeMarkdown(const std::string& text);
-    
-    // Utility methods
-    std::string getModulePath(const std::string& moduleName);
-    std::string getAnchorLink(const std::string& name);
-    std::string getMaterialIcon(const std::string& type);
-    std::string formatFunctionSignature(const FunctionNode& func);
-    
-    // Module management
-    void enterModule(const std::string& moduleName);
-    void exitModule();
-    ModuleInfo& getCurrentModule();
-    void addToCurrentModule(const std::string& type, const std::string& name);
-};
-```
-
-### C++ Parser Implementation Sketch
-```cpp
-// cpp_parser.h
-#pragma once
-
-#include "parser_interface.h"
-#include <regex>
-#include <map>
-
-/**
- * @brief C++ language parser
- */
-class CppParser : public ILanguageParser {
-private:
-    // Token types
-    enum class TokenType {
-        KEYWORD,
-        IDENTIFIER,
-        SYMBOL,
-        COMMENT,
-        PREPROCESSOR,
-        STRING_LITERAL,
-        NUMBER,
-        WHITESPACE,
-        UNKNOWN
-    };
-    
-    struct Token {
-        TokenType type;
-        std::string value;
-        SourceLocation location;
-    };
-    
-    // Comment tracking
-    struct CommentInfo {
-        DocumentationComment comment;
-        bool attached = false;
-    };
-    
-    std::map<std::pair<int, int>, CommentInfo> pendingComments;
-    
-public:
-    std::vector<std::unique_ptr<ASTNode>> parseFile(const std::string& filePath) override;
-    std::string getLanguage() const override { return "cpp"; }
-    std::vector<std::string> getFileExtensions() const override {
-        return {".cpp", ".h", ".hpp", ".cxx", ".cc", ".c"};
-    }
-    bool canParse(const std::string& filePath) const override;
-    
-private:
-    // Tokenization
-    std::vector<Token> tokenize(const std::string& source, const std::string& filePath);
-    
-    // Parsing methods
-    std::vector<std::unique_ptr<ASTNode>> parseTokens(const std::vector<Token>& tokens);
-    std::unique_ptr<ClassNode> parseClass(const std::vector<Token>& tokens, size_t& pos);
-    std::unique_ptr<FunctionNode> parseFunction(const std::vector<Token>& tokens, size_t& pos);
-    std::unique_ptr<NamespaceNode> parseNamespace(const std::vector<Token>& tokens, size_t& pos);
-    std::unique_ptr<VariableNode> parseVariable(const std::vector<Token>& tokens, size_t& pos);
-    std::unique_ptr<EnumNode> parseEnum(const std::vector<Token>& tokens, size_t& pos);
-    
-    // Comment processing
-    void extractComments(const std::string& source);
-    DocumentationComment parseComment(const std::string& content, SourceLocation location);
-    void attachComments(ASTNode* node, int line);
-    
-    // Utility methods
-    bool isKeyword(const std::string& token) const;
-    bool isTypeQualifier(const std::string& token) const;
-    bool isAccessSpecifier(const std::string& token) const;
-    std::string parseQualifiedName(const std::vector<Token>& tokens, size_t& pos);
-    Parameter parseParameter(const std::vector<Token>& tokens, size_t& pos);
-    
-    // Regular expressions
-    std::regex commentRegex = std::regex(R"((/\*\*.*?\*/|///.*?$|//!.*?$))", std::regex::dotall);
-    std::regex doxygenTagRegex = std::regex(R"(@(\w+)(?:\s+(.+?))?(?=\s+@|\s*$))");
-};
-```
-
-## Usage Example
-
-```cpp
-// main.cpp
-#include "cpp_parser.h"
-#include "documentation_generator.h"
-
-int main(int argc, char* argv[]) {
-    if (argc < 3) {
-        std::cerr << "Usage: docs-parser <input> <output>" << std::endl;
-        return 1;
-    }
-    
-    // Configure documentation generation
-    DocumentationConfig config;
-    config.outputDirectory = argv[2];
-    config.indexTitle = "My Project Documentation";
-    config.generatorName = "docs-parser";
-    
-    // Create C++ parser
-    CppParser parser;
-    DocumentationGenerator generator(config);
-    
-    // Parse source files
-    std::vector<std::unique_ptr<ASTNode>> allNodes;
-    std::vector<std::string> sourceFiles = findSourceFiles(argv[1], {"cpp", "h", "hpp"});
-    
-    for (const auto& file : sourceFiles) {
-        auto nodes = parser.parseFile(file);
-        for (auto& node : nodes) {
-            allNodes.push_back(std::move(node));
-        }
-    }
-    
-    // Generate documentation
-    generator.generate(allNodes);
-    
-    std::cout << "Documentation generated in " << config.outputDirectory << std::endl;
-    return 0;
-}
-```
-
-This technical specification provides the foundation for implementing a robust, extensible documentation parser with clean separation of concerns and a pluggable architecture for supporting multiple programming languages.

+ 0 - 28
test-output/index.md

@@ -1,28 +0,0 @@
----
-generator: docs-rag-parser
----
-
-# Source Code Documentation
-
-:material-package: [test-calculator](test-calculator/index.md)
-:   A simple calculator class
-This class provides basic arithmetic operations for everyday calculations.
-
-Features:
-- Addition and subtraction
-- Multiplication and division
-- Memory storage functionality Global utility function for calculations
-This function demonstrates global documentation patterns.
-
-## Types
-
-| Name | Description |
-| ---- | ----------- |
-| [Calculator](test-calculator/Calculator.md) | A simple calculator class
-This class provides basic arithmetic operations for everyday calculations.
-
-Features:
-- Addition and subtraction
-- Multiplication and division
-- Memory storage functionality |
-

+ 0 - 68
test-output/test-calculator/Calculator.md

@@ -1,68 +0,0 @@
----
-generator: docs-rag-parser
----
-
-# Calculator
-
-**class Calculator**
-
-@brief A simple calculator class
-This class provides basic arithmetic operations for everyday calculations.
-
-Features:
-- Addition and subtraction
-- Multiplication and division
-- Memory storage functionality
-
-
-
-## Functions
-
-| Name | Description |
-| --- | --- |
-| [Calculator](#calculator) | Default constructor that initializes memory to zero |
-| [add](#add) | Add two numbers together |
-| [multiply](#multiply) | Multiply two numbers |
-| [storeInMemory](#storeinmemory) | Store a value in memory |
-
-## Function Details
-
-### Calculator<a name="calculator"></a>
-!!! function "Calculator();"
-
-    @brief Default constructor that initializes memory to zero
-    
-    
-
-### add<a name="add"></a>
-!!! function "double add(double a, double b);"
-
-    @brief Add two numbers together
-    
-    @param a First number to add
-    @param b Second number to add
-    @return Sum of a and b
-    @example double result = calc.add(5.0, 3.0); // result = 8.0
-    
-    
-
-### multiply<a name="multiply"></a>
-!!! function "double multiply(double a, double b);"
-
-    @brief Multiply two numbers
-    
-    @param a First number to multiply
-    @param b Second number to multiply
-    @return Product of a and b
-    
-    
-
-### storeInMemory<a name="storeinmemory"></a>
-!!! function "void storeInMemory(double value);"
-
-    @brief Store a value in memory
-    
-    @param value The value to store
-    
-    
-

+ 0 - 18
test-output/test-calculator/index.md

@@ -1,18 +0,0 @@
----
-generator: docs-rag-parser
----
-
-# test-calculator
-
-## Types
-
-| Name | Description |
-| ---- | ----------- |
-| [Calculator](Calculator.md) | A simple calculator class
-This class provides basic arithmetic operations for everyday calculations.
-
-Features:
-- Addition and subtraction
-- Multiplication and division
-- Memory storage functionality |
-

+ 0 - 26
test-output/test-calculator/square.md

@@ -1,26 +0,0 @@
----
-generator: docs-rag-parser
----
-
-# square
-
-**function square**
-
-@brief Global utility function for calculations
-This function demonstrates global documentation patterns.
-
-@param value The value to square
-@return The squared value
-
-
-
-## Signature
-
-```cpp
-double square(double value);
-```
-
-## Source Location
-
-File: `/data/docs-rag/test-calculator.h`:54
-

+ 0 - 1003
typescript-implementation.md

@@ -1,1003 +0,0 @@
-# TypeScript Source Code Parser - Quick Start Implementation
-
-## Project Integration
-
-This implementation integrates directly into the existing `docs-rag` TypeScript project.
-
-## 1. Update package.json
-
-Add new dependencies to `package.json`:
-
-```json
-{
-  "dependencies": {
-    "@types/node": "^24.10.1",
-    "commander": "^14.0.2",
-    "fs-extra": "^11.3.2",
-    "glob": "^13.0.0",
-    "typescript": "^5.9.3",
-    "zod": "^4.1.12",
-    "chokidar": "^4.0.1"
-  },
-  "scripts": {
-    "build": "tsc",
-    "start": "node dist/cli/index.js",
-    "dev": "tsx src/cli/index.ts",
-    "mcp": "tsx src/mcp/server.ts",
-    "cli": "node dist/cli/index.js",
-    "parse": "node dist/cli/index.js parse",
-    "parse:dev": "tsx src/cli/index.ts parse"
-  }
-}
-```
-
-## 2. Core Implementation Files
-
-### Create Directory Structure
-
-```bash
-mkdir -p src/lib/parser/{core,parsers,ast,utils}
-mkdir -p src/types
-```
-
-### Type Definitions (src/types/parser-types.ts)
-
-```typescript
-export interface SourceLocation {
-  filePath: string;
-  line: number;
-  column: number;
-  endLine?: number;
-  endColumn?: number;
-}
-
-export interface DocumentationComment {
-  type: 'doxline' | 'doxyblock' | 'javadoc' | 'unknown';
-  rawContent: string;
-  brief: string;
-  detailed: string;
-  tags: DocTag[];
-  location: SourceLocation;
-}
-
-export interface DocTag {
-  name: string;
-  value: string;
-}
-
-export interface ASTNode {
-  type: 'namespace' | 'class' | 'struct' | 'function' | 'method' | 
-        'variable' | 'enum' | 'enum_value' | 'template' | 'module';
-  name: string;
-  documentation: DocumentationComment;
-  location: SourceLocation;
-  children: ASTNode[];
-  [key: string]: any; // Allow type-specific properties
-}
-
-export interface DocumentationConfig {
-  outputDirectory: string;
-  indexTitle: string;
-  generatorName: string;
-  generateIndex: boolean;
-  generateModuleIndexes: boolean;
-  includePrivate: boolean;
-  includeSourceLinks: boolean;
-  sourceRootPath?: string;
-  theme: 'material' | 'github' | 'default';
-}
-
-export interface ParserConfig {
-  languages: string[];
-  includePatterns: string[];
-  excludePatterns: string[];
-  outputPath: string;
-  watchMode: boolean;
-  incremental: boolean;
-}
-```
-
-### Parser Interface (src/lib/parser/core/interfaces.ts)
-
-```typescript
-import { ASTNode, DocumentationComment, SourceLocation, DocumentationConfig } from '../../../types/parser-types';
-
-export interface ILanguageParser {
-  getLanguage(): string;
-  getFileExtensions(): string[];
-  canParse(filePath: string): boolean;
-  parseFile(filePath: string): Promise<ASTNode[]>;
-}
-
-export interface ParseOptions {
-  inputPath: string;
-  outputPath: string;
-  languages: string[];
-  configPath?: string;
-  watch?: boolean;
-  incremental?: boolean;
-  includePrivate?: boolean;
-  dryRun?: boolean;
-}
-
-export interface ParseResult {
-  processedFiles: number;
-  generatedFiles: number;
-  filesToProcess: string[];
-  errors: string[];
-  estimatedFiles: number;
-}
-
-export interface ValidationResult {
-  inputValid: boolean;
-  configValid: boolean;
-  supportedFiles: string[];
-  unsupportedFiles: string[];
-  warnings: string[];
-}
-
-export interface LanguageInfo {
-  name: string;
-  description: string;
-  extensions: string[];
-}
-```
-
-### File Utilities (src/lib/parser/utils/file-utils.ts)
-
-```typescript
-import { promises as fs } from 'fs';
-import { join, resolve } from 'path';
-import { glob } from 'glob';
-
-export class FileUtils {
-  static async readFile(filePath: string): Promise<string> {
-    return await fs.readFile(filePath, 'utf-8');
-  }
-
-  static async writeFile(filePath: string, content: string): Promise<void> {
-    const dir = filePath.substring(0, filePath.lastIndexOf('/'));
-    await this.ensureDirectory(dir);
-    await fs.writeFile(filePath, content, 'utf-8');
-  }
-
-  static async ensureDirectory(dirPath: string): Promise<void> {
-    try {
-      await fs.access(dirPath);
-    } catch {
-      await fs.mkdir(dirPath, { recursive: true });
-    }
-  }
-
-  static async exists(filePath: string): Promise<boolean> {
-    try {
-      await fs.access(filePath);
-      return true;
-    } catch {
-      return false;
-    }
-  }
-
-  static async getAllFiles(dirPath: string): Promise<string[]> {
-    const files = await glob(join(dirPath, '**/*'), {
-      nodir: true,
-      absolute: true
-    });
-    return files;
-  }
-
-  static async getAllSourceFiles(dirPath: string, extensions: string[]): Promise<string[]> {
-    const pattern = join(dirPath, '**/*{${extensions.join(',')}}');
-    const files = await glob(pattern, {
-      nodir: true,
-      absolute: true
-    });
-    return files;
-  }
-}
-```
-
-### Markdown Utilities (src/lib/parser/utils/markdown-utils.ts)
-
-```typescript
-export class MarkdownUtils {
-  static escape(text: string): string {
-    return text
-      .replace(/\\/g, '\\\\')
-      .replace(/#/g, '\\#')
-      .replace(/\*/g, '\\*')
-      .replace(/_/g, '\\_')
-      .replace(/`/g, '\\`')
-      .replace(/\[/g, '\\[')
-      .replace(/\]/g, '\\]');
-  }
-
-  static generateAnchor(text: string): string {
-    return text
-      .toLowerCase()
-      .replace(/[^a-z0-9\s-]/g, '')
-      .replace(/\s+/g, '-')
-      .replace(/-+/g, '-')
-      .replace(/^-|-$/g, '');
-  }
-
-  static formatCodeBlock(code: string, language?: string): string {
-    const lang = language || '';
-    return `\`\`\`${lang}\n${code}\n\`\`\``;
-  }
-
-  static formatTable(headers: string[], rows: string[][]): string {
-    if (rows.length === 0) return '';
-
-    let table = '| ' + headers.join(' | ') + ' |\n';
-    table += '| ' + headers.map(() => '---').join(' | ') + ' |\n';
-
-    for (const row of rows) {
-      table += '| ' + row.map(cell => cell || '').join(' | ') + ' |\n';
-    }
-
-    return table;
-  }
-}
-```
-
-### Base Parser (src/lib/parser/parsers/base-parser.ts)
-
-```typescript
-import { ILanguageParser } from '../core/interfaces';
-
-export abstract class BaseParser implements ILanguageParser {
-  abstract getLanguage(): string;
-  abstract getFileExtensions(): string[];
-  abstract parseFile(filePath: string): Promise<any[]>;
-
-  canParse(filePath: string): boolean {
-    const ext = filePath.substring(filePath.lastIndexOf('.'));
-    return this.getFileExtensions().includes(ext);
-  }
-
-  protected createEmptyDocumentation() {
-    return {
-      type: 'unknown' as const,
-      rawContent: '',
-      brief: '',
-      detailed: '',
-      tags: [],
-      location: { filePath: '', line: 0, column: 0 }
-    };
-  }
-
-  protected extractBrief(text: string): string {
-    const sentences = text.split(/[.!?]/);
-    if (sentences.length > 1 && sentences[0].length < 100) {
-      return sentences[0].trim() + '.';
-    }
-    
-    const lines = text.split('\n');
-    return lines[0].trim() || text.substring(0, 80).trim();
-  }
-}
-```
-
-### C++ Parser (src/lib/parser/parsers/cpp-parser.ts)
-
-```typescript
-import { BaseParser } from './base-parser';
-import { FileUtils } from '../utils/file-utils';
-import { ASTNode, DocumentationComment } from '../../../types/parser-types';
-
-export class CppParser extends BaseParser {
-  getLanguage(): string {
-    return 'cpp';
-  }
-
-  getFileExtensions(): string[] {
-    return ['.cpp', '.h', '.hpp', '.cxx', '.cc', '.c'];
-  }
-
-  async parseFile(filePath: string): Promise<ASTNode[]> {
-    const content = await FileUtils.readFile(filePath);
-    const lines = content.split('\n');
-    
-    const comments = this.extractComments(lines);
-    const nodes = await this.parseCodeElements(lines, comments, filePath);
-    
-    return nodes;
-  }
-
-  private extractComments(lines: string[]): Map<number, DocumentationComment> {
-    const comments = new Map<number, DocumentationComment>();
-    
-    for (let i = 0; i < lines.length; i++) {
-      const line = lines[i];
-      const trimmed = line.trim();
-      
-      if (trimmed.startsWith('/**')) {
-        const comment = this.parseBlockComment(lines, i);
-        if (comment) {
-          comments.set(i + 1, comment);
-          i += this.getCommentHeight(comment.rawContent) - 1;
-        }
-      } else if (trimmed.startsWith('///') || trimmed.startsWith('//!')) {
-        const comment = this.parseLineComment(lines, i);
-        if (comment) {
-          comments.set(i + 1, comment);
-        }
-      }
-    }
-    
-    return comments;
-  }
-
-  private parseBlockComment(lines: string[], startIndex: number): DocumentationComment | null {
-    let content = '';
-    let i = startIndex;
-    
-    while (i < lines.length && !lines[i].includes('*/')) {
-      content += lines[i] + '\n';
-      i++;
-    }
-    if (i < lines.length) {
-      content += lines[i] + '\n';
-    }
-    
-    return this.parseCommentContent(content, 'doxyblock', startIndex + 1);
-  }
-
-  private parseLineComment(lines: string[], startIndex: number): DocumentationComment | null {
-    const line = lines[startIndex];
-    return this.parseCommentContent(line, 'doxline', startIndex + 1);
-  }
-
-  private parseCommentContent(rawContent: string, type: 'doxline' | 'doxyblock', line: number): DocumentationComment {
-    const cleaned = rawContent
-      .replace(/\/\*\*|\/\*|\*\/|\/\/\/|\/\!/g, '')
-      .split('\n')
-      .map(line => line.trim().replace(/^\*\s?/, ''))
-      .join('\n')
-      .trim();
-
-    const tagRegex = /@(\w+)(?:\s+(.+?))?(?=\s+@|$)/gs;
-    const tags: { name: string; value: string }[] = [];
-    let tagMatch;
-    
-    while ((tagMatch = tagRegex.exec(cleaned)) !== null) {
-      tags.push({
-        name: tagMatch[1],
-        value: tagMatch[2]?.trim() || ''
-      });
-    }
-
-    const beforeTags = cleaned.split('@')[0].trim();
-    const brief = this.extractBrief(beforeTags);
-
-    return {
-      type,
-      rawContent,
-      brief,
-      detailed: beforeTags.substring(brief.length).trim(),
-      tags,
-      location: { filePath: '', line, column: 0 }
-    };
-  }
-
-  private getCommentHeight(content: string): number {
-    return content.split('\n').length;
-  }
-
-  private async parseCodeElements(
-    lines: string[], 
-    comments: Map<number, DocumentationComment>, 
-    filePath: string
-  ): Promise<ASTNode[]> {
-    const nodes: ASTNode[] = [];
-    
-    for (let i = 0; i < lines.length; i++) {
-      const line = lines[i];
-      
-      const classMatch = line.match(/^\s*(class|struct)\s+(\w+)/);
-      if (classMatch) {
-        const node = await this.parseClass(lines, i, comments, filePath);
-        if (node) {
-          nodes.push(node);
-        }
-      }
-      
-      const functionMatch = line.match(/^\s*(?:\w+\s+)*(\w+)\s*\([^)]*\)\s*(?:\{|;)/);
-      if (functionMatch && !line.includes('class')) {
-        const node = await this.parseFunction(lines, i, comments, filePath);
-        if (node) {
-          nodes.push(node);
-        }
-      }
-    }
-    
-    return nodes;
-  }
-
-  private async parseClass(
-    lines: string[], 
-    startIndex: number,
-    comments: Map<number, DocumentationComment>,
-    filePath: string
-  ): Promise<ASTNode | null> {
-    const line = lines[startIndex];
-    const match = line.match(/^\s*(class|struct)\s+(\w+)/);
-    
-    if (!match) return null;
-    
-    const [, type, name] = match;
-    
-    let comment = comments.get(startIndex);
-    if (!comment) {
-      comment = comments.get(startIndex - 1);
-    }
-    
-    return {
-      type: type as 'class' | 'struct',
-      name,
-      documentation: comment || this.createEmptyDocumentation(),
-      location: { filePath, line: startIndex + 1, column: 0 },
-      children: [],
-      isStruct: type === 'struct'
-    };
-  }
-
-  private async parseFunction(
-    lines: string[], 
-    startIndex: number,
-    comments: Map<number, DocumentationComment>,
-    filePath: string
-  ): Promise<ASTNode | null> {
-    const line = lines[startIndex];
-    const match = line.match(/^\s*(?:\w+\s+)*(\w+)\s*\([^)]*\)\s*(?:\{|;)/);
-    
-    if (!match) return null;
-    
-    const [, name] = match;
-    
-    let comment = comments.get(startIndex);
-    if (!comment) {
-      comment = comments.get(startIndex - 1);
-    }
-    
-    return {
-      type: 'function',
-      name,
-      documentation: comment || this.createEmptyDocumentation(),
-      location: { filePath, line: startIndex + 1, column: 0 },
-      children: [],
-      signature: line.trim()
-    };
-  }
-}
-```
-
-### Documentation Generator (src/lib/parser/core/documentation-generator.ts)
-
-```typescript
-import { ASTNode, DocumentationConfig } from '../../../types/parser-types';
-import { FileUtils } from '../utils/file-utils';
-import { MarkdownUtils } from '../utils/markdown-utils';
-
-export class DocumentationGenerator {
-  private config: DocumentationConfig;
-
-  constructor(config: DocumentationConfig) {
-    this.config = config;
-  }
-
-  async generate(nodes: ASTNode[]): Promise<void> {
-    await FileUtils.ensureDirectory(this.config.outputDirectory);
-    
-    if (this.config.generateIndex) {
-      await this.generateIndex(nodes);
-    }
-    
-    await this.generateModuleDocumentation(nodes);
-    await this.generateNodeFiles(nodes);
-  }
-
-  private async generateIndex(nodes: ASTNode[]): Promise<void> {
-    const modules = this.organizeByModule(nodes);
-    let content = `---
-generator: ${this.config.generatorName}
----
-
-# ${this.config.indexTitle}
-
-`;
-
-    for (const [moduleName, moduleNodes] of modules.entries()) {
-      content += this.generateModuleSection(moduleName, moduleNodes);
-    }
-
-    const indexPath = `${this.config.outputDirectory}/index.md`;
-    await FileUtils.writeFile(indexPath, content);
-  }
-
-  private organizeByModule(nodes: ASTNode[]): Map<string, ASTNode[]> {
-    const modules = new Map<string, ASTNode[]>();
-    
-    for (const node of nodes) {
-      const moduleName = this.extractModuleName(node);
-      if (!modules.has(moduleName)) {
-        modules.set(moduleName, []);
-      }
-      modules.get(moduleName)!.push(node);
-    }
-    
-    return modules;
-  }
-
-  private extractModuleName(node: ASTNode): string {
-    if (node.type === 'namespace') {
-      return node.name;
-    }
-    
-    const pathParts = node.location.filePath.split('/');
-    const fileName = pathParts[pathParts.length - 1];
-    const moduleName = fileName.replace(/\.(cpp|h|hpp|cxx|cc|c)$/, '');
-    
-    return moduleName;
-  }
-
-  private generateModuleSection(moduleName: string, nodes: ASTNode[]): string {
-    let section = `:material-package: [${moduleName}](${moduleName}/index.md)
-:   ${this.generateModuleDescription(nodes)}
-
-`;
-
-    const classes = nodes.filter(n => n.type === 'class' || n.type === 'struct');
-    const functions = nodes.filter(n => n.type === 'function' || n.type === 'method');
-
-    if (classes.length > 0) {
-      section += '## Types\n\n| Name | Description |\n| ---- | ----------- |\n';
-      for (const cls of classes) {
-        const desc = cls.documentation.brief || '';
-        section += `| [${cls.name}](${moduleName}/${cls.name}.md) | ${desc} |\n`;
-      }
-      section += '\n';
-    }
-
-    return section;
-  }
-
-  private async generateModuleDocumentation(nodes: ASTNode[]): Promise<void> {
-    const modules = this.organizeByModule(nodes);
-    
-    for (const [moduleName, moduleNodes] of modules.entries()) {
-      await this.generateModuleFile(moduleName, moduleNodes);
-    }
-  }
-
-  private async generateModuleFile(moduleName: string, nodes: ASTNode[]): Promise<void> {
-    const modulePath = `${this.config.outputDirectory}/${moduleName}`;
-    await FileUtils.ensureDirectory(modulePath);
-    
-    let content = `---
-generator: ${this.config.generatorName}
----
-
-# ${moduleName}
-
-`;
-
-    const classes = nodes.filter(n => n.type === 'class' || n.type === 'struct');
-    const functions = nodes.filter(n => n.type === 'function' || n.type === 'method');
-
-    if (classes.length > 0) {
-      content += '## Types\n\n| Name | Description |\n| ---- | ----------- |\n';
-      for (const cls of classes) {
-        const desc = cls.documentation.brief || '';
-        content += `| [${cls.name}](${cls.name}.md) | ${desc} |\n`;
-      }
-      content += '\n';
-    }
-
-    const indexPath = `${this.config.outputDirectory}/${moduleName}/index.md`;
-    await FileUtils.writeFile(indexPath, content);
-  }
-
-  private async generateNodeFiles(nodes: ASTNode[]): Promise<void> {
-    for (const node of nodes) {
-      if (node.type === 'class' || node.type === 'struct') {
-        await this.generateClassFile(node);
-      } else if (node.type === 'function' || node.type === 'method') {
-        await this.generateFunctionFile(node);
-      }
-    }
-  }
-
-  private async generateClassFile(node: ASTNode): Promise<void> {
-    const moduleName = this.extractModuleName(node);
-    const filePath = `${this.config.outputDirectory}/${moduleName}/${node.name}.md`;
-    
-    let content = `---
-generator: ${this.config.generatorName}
----
-
-# ${node.name}
-
-**${node.type} ${node.name}**
-
-${this.formatDocumentation(node.documentation)}
-
-`;
-
-    const methods = node.children.filter(n => n.type === 'function' || n.type === 'method');
-    if (methods.length > 0) {
-      content += '## Functions\n\n';
-      content += this.generateFunctionTable(methods);
-      content += '\n## Function Details\n\n';
-      content += this.generateFunctionDetails(methods);
-    }
-
-    await FileUtils.writeFile(filePath, content);
-  }
-
-  private async generateFunctionFile(node: ASTNode): Promise<void> {
-    const moduleName = this.extractModuleName(node);
-    const filePath = `${this.config.outputDirectory}/${moduleName}/${node.name}.md`;
-    
-    const content = `---
-generator: ${this.config.generatorName}
----
-
-# ${node.name}
-
-**function ${node.name}**
-
-${this.formatDocumentation(node.documentation)}
-
-## Signature
-
-${MarkdownUtils.formatCodeBlock(node.signature || node.name, 'cpp')}
-
-## Source Location
-
-File: \`${node.location.filePath}\`:${node.location.line}
-
-`;
-
-    await FileUtils.writeFile(filePath, content);
-  }
-
-  private generateFunctionTable(functions: ASTNode[]): string {
-    const headers = ['Name', 'Description'];
-    const rows = functions.map(func => {
-      const desc = func.documentation.brief || '';
-      const anchor = MarkdownUtils.generateAnchor(func.name);
-      return [`[${func.name}](#${anchor})`, desc];
-    });
-    
-    return MarkdownUtils.formatTable(headers, rows);
-  }
-
-  private generateFunctionDetails(functions: ASTNode[]): string {
-    let details = '';
-    
-    for (const func of functions) {
-      const anchor = MarkdownUtils.generateAnchor(func.name);
-      details += `### ${func.name}<a name="${anchor}"></a>\n`;
-      details += `!!! function "${this.formatFunctionSignature(func)}"\n\n`;
-      details += `    ${this.formatDocumentation(func.documentation).replace(/\n/g, '\n    ')}\n\n`;
-    }
-    
-    return details;
-  }
-
-  private formatDocumentation(doc: DocumentationComment): string {
-    if (!doc.brief && !doc.detailed) return '';
-    
-    let formatted = '';
-    if (doc.brief) formatted += `@brief ${doc.brief}\n\n`;
-    if (doc.detailed) formatted += `${doc.detailed}\n\n`;
-    
-    return formatted;
-  }
-
-  private formatFunctionSignature(func: ASTNode): string {
-    return func.signature || `${func.name}()`;
-  }
-
-  private generateModuleDescription(nodes: ASTNode[]): string {
-    const descriptions = nodes
-      .map(n => n.documentation.brief)
-      .filter(Boolean)
-      .slice(0, 2);
-    
-    return descriptions.join(' ') || 'Module containing various components and utilities.';
-  }
-}
-```
-
-## 3. CLI Integration
-
-### Update Main CLI (src/cli/index.ts)
-
-```typescript
-#!/usr/bin/env node
-
-import { Command } from 'commander';
-import { DocumentService } from '../services/documentService';
-import { existsSync } from 'fs';
-import { parserCommands } from './parser-commands';
-
-const program = new Command();
-const documentService = new DocumentService();
-
-program
-  .name('docs-rag')
-  .description('CLI tool for managing markdown documents in Qdrant and parsing source code')
-  .version('1.0.0');
-
-// ... existing commands remain unchanged ...
-
-// Add parser commands
-parserCommands(program);
-
-program.parse();
-```
-
-### Parser Commands (src/cli/parser-commands.ts)
-
-```typescript
-#!/usr/bin/env node
-
-import { Command } from 'commander';
-import { ParseService } from '../services/parseService';
-import { existsSync } from 'fs';
-import { resolve } from 'path';
-
-const parseService = new ParseService();
-
-export const parserCommands = (program: Command) => {
-  program
-    .command('parse')
-    .description('Generate documentation from source code comments')
-    .requiredOption('-i, --input <path>', 'Input directory containing source files')
-    .requiredOption('-o, --output <path>', 'Output directory for generated documentation')
-    .option('-l, --languages <languages>', 'Comma-separated list of languages to parse', 'cpp')
-    .option('-w, --watch', 'Watch for file changes and regenerate', false)
-    .option('--dry-run', 'Show what would be parsed without generating files', false)
-    .action(async (options) => {
-      if (!existsSync(options.input)) {
-        console.error(`Error: Input directory '${options.input}' does not exist`);
-        process.exit(1);
-      }
-
-      try {
-        const result = await parseService.generateDocumentation({
-          inputPath: resolve(options.input),
-          outputPath: resolve(options.output),
-          languages: options.languages.split(',').map((l: string) => l.trim()),
-          watch: options.watch,
-          dryRun: options.dryRun
-        });
-
-        if (options.dryRun) {
-          console.log('Dry run results:');
-          console.log(`  Files to process: ${result.filesToProcess.length}`);
-          result.filesToProcess.forEach(file => console.log(`    - ${file}`));
-        } else {
-          console.log(`Documentation generated successfully!`);
-          console.log(`  Processed ${result.processedFiles} files`);
-          console.log(`  Generated ${result.generatedFiles} documentation files`);
-          console.log(`  Output directory: ${options.output}`);
-        }
-      } catch (error) {
-        console.error('Error:', error);
-        process.exit(1);
-      }
-    });
-
-  program
-    .command('parse-list-languages')
-    .description('List all supported parser languages')
-    .action(() => {
-      const languages = parseService.getSupportedLanguages();
-      console.log('Supported languages:');
-      languages.forEach(lang => {
-        console.log(`  ${lang.name}: ${lang.description}`);
-        console.log(`    Extensions: ${lang.extensions.join(', ')}`);
-        console.log();
-      });
-    });
-};
-```
-
-### Parse Service (src/services/parseService.ts)
-
-```typescript
-import { 
-  ILanguageParser, 
-  DocumentationConfig, 
-  ParseOptions, 
-  ParseResult,
-  ValidationResult,
-  LanguageInfo
-} from '../lib/parser/core/interfaces';
-import { CppParser } from '../lib/parser/parsers/cpp-parser';
-import { DocumentationGenerator } from '../lib/parser/core/documentation-generator';
-import { FileUtils } from '../lib/parser/utils/file-utils';
-
-export class ParseService {
-  private parsers: Map<string, ILanguageParser> = new Map();
-
-  constructor() {
-    this.registerDefaultParsers();
-  }
-
-  private registerDefaultParsers(): void {
-    this.parsers.set('cpp', new CppParser());
-  }
-
-  getSupportedLanguages(): LanguageInfo[] {
-    return Array.from(this.parsers.entries()).map(([key, parser]) => ({
-      name: key,
-      description: `${key.toUpperCase()} source code parser`,
-      extensions: parser.getFileExtensions()
-    }));
-  }
-
-  async generateDocumentation(options: ParseOptions): Promise<ParseResult> {
-    const config = this.createDefaultConfig(options);
-    const sourceFiles = await this.findSourceFiles(options.inputPath, options.languages);
-    
-    if (options.dryRun) {
-      return {
-        processedFiles: 0,
-        generatedFiles: 0,
-        filesToProcess: sourceFiles,
-        errors: [],
-        estimatedFiles: this.estimateOutputFiles(sourceFiles)
-      };
-    }
-
-    const nodes = [];
-    const errors = [];
-
-    for (const filePath of sourceFiles) {
-      try {
-        const fileNodes = await this.parseFile(filePath);
-        nodes.push(...fileNodes);
-      } catch (error) {
-        errors.push(`Failed to parse ${filePath}: ${error}`);
-      }
-    }
-
-    const generator = new DocumentationGenerator(config);
-    await generator.generate(nodes);
-
-    const generatedFiles = await this.countGeneratedFiles(config.outputDirectory);
-
-    return {
-      processedFiles: sourceFiles.length,
-      generatedFiles,
-      filesToProcess: sourceFiles,
-      errors
-    };
-  }
-
-  private createDefaultConfig(options: ParseOptions): DocumentationConfig {
-    return {
-      outputDirectory: options.outputPath,
-      indexTitle: 'Source Code Documentation',
-      generatorName: 'docs-rag-parser',
-      generateIndex: true,
-      generateModuleIndexes: true,
-      includePrivate: options.includePrivate || false,
-      includeSourceLinks: true,
-      sourceRootPath: options.inputPath,
-      theme: 'material'
-    };
-  }
-
-  private async findSourceFiles(inputPath: string, languages: string[]): Promise<string[]> {
-    const allFiles = await FileUtils.getAllFiles(inputPath);
-    
-    return allFiles.filter(file => {
-      const parser = this.getParserForFile(file);
-      return parser && languages.includes(parser.getLanguage());
-    });
-  }
-
-  private getParserForFile(filePath: string): ILanguageParser | null {
-    const ext = filePath.substring(filePath.lastIndexOf('.'));
-    
-    for (const parser of this.parsers.values()) {
-      if (parser.getFileExtensions().includes(ext)) {
-        return parser;
-      }
-    }
-    
-    return null;
-  }
-
-  private async parseFile(filePath: string): Promise<any[]> {
-    const parser = this.getParserForFile(filePath);
-    if (!parser) {
-      throw new Error(`No parser found for file: ${filePath}`);
-    }
-
-    return await parser.parseFile(filePath);
-  }
-
-  private estimateOutputFiles(sourceFiles: string[]): number {
-    const uniqueNames = new Set(sourceFiles.map(file => 
-      require('path').basename(file).replace(/\.(cpp|h|hpp|cxx|cc|c)$/, '')
-    ));
-    return uniqueNames.size + Math.floor(sourceFiles.length * 2);
-  }
-
-  private async countGeneratedFiles(outputDirectory: string): Promise<number> {
-    try {
-      const files = await FileUtils.getAllFiles(outputDirectory);
-      return files.filter(file => file.endsWith('.md')).length;
-    } catch {
-      return 0;
-    }
-  }
-}
-```
-
-## 4. Build and Run
-
-```bash
-# Install dependencies
-npm install
-
-# Build the project
-npm run build
-
-# Run the parser
-npm run parse -- -i /path/to/cpp/source -o ./output/docs
-
-# Dry run to see what would be processed
-npm run parse -- -i /path/to/cpp/source -o ./output/docs --dry-run
-
-# List supported languages
-node dist/cli/index.js parse-list-languages
-```
-
-## 5. Test Example
-
-Create a test C++ file:
-
-```cpp
-/**
- * @brief A simple calculator class
- * This class provides basic arithmetic operations.
- */
-class Calculator {
-public:
-    /// @brief Add two numbers
-    int add(int a, int b);
-    
-    /**
-     * @brief Multiply two numbers
-     * @param a First number
-     * @param b Second number
-     * @return Product of a and b
-     */
-    int multiply(int a, int b);
-};
-```
-
-Run the parser:
-
-```bash
-npm run parse -- -i . ./test-docs
-```
-
-Expected output structure:
-```
-test-docs/
-├── index.md
-└── Calculator/
-    ├── index.md
-    └── Calculator.md
-```
-
-This implementation provides a solid foundation for a TypeScript-based source code parser integrated into the existing docs-rag project.