# Task ID: 4
# Title: Implement Output Formatter with Template System
# Status: done
# Dependencies: 2
# Priority: high
# Description: Create a flexible output formatter that supports customizable templates with variable substitution and multiple output formats for different AI systems.
# Details:
Develop an OutputFormatter class that handles template processing and multi-format support:

```typescript
export class OutputFormatter {
  private configManager: ConfigurationManager;
  
  constructor(configManager: ConfigurationManager) {
    this.configManager = configManager;
  }
  
  public formatOutput(files: FileData[]): Map<string, string> {
    const config = this.configManager.getConfig();
    const outputs = new Map<string, string>();
    
    for (const format of config.formats) {
      let output = format.template;
      
      // Process template variables
      output = output.replace('{{files}}', this.formatFiles(files, format));
      output = output.replace('{{fileCount}}', files.length.toString());
      output = output.replace('{{timestamp}}', new Date().toISOString());
      
      // Add prepend content if specified
      if (format.prependContent) {
        output = format.prependContent + output;
      }
      
      outputs.set(format.path, output);
    }
    
    return outputs;
  }
  
  private formatFiles(files: FileData[], format: OutputFormat): string {
    // Format files according to template
    // This could be JSON, markdown, or custom format
  }
}
```

Implement support for various output formats including JSON, Markdown, and plain text. Create a flexible template system with variable substitution for file paths, content, and metadata. Support custom delimiters and formatting options. Use a streaming approach for large files to minimize memory usage.

# Test Strategy:
1. Test template processing with various input templates
2. Verify variable substitution works correctly
3. Test different output formats (JSON, Markdown, etc.)
4. Test with large file sets to ensure performance
5. Verify proper handling of special characters and escaping
