Skip to content

Latest commit

 

History

History
90 lines (69 loc) · 2.66 KB

micro-export-format.md

File metadata and controls

90 lines (69 loc) · 2.66 KB

Micro Export Format

Micro Export Format Improvements

CodebaseMD 3.0 retains the Micro representation introduced in v2.0 and improved in v2.0.2. This heuristic analyzer summarizes recognizable declarations, members, and flow patterns; it is not a full parser and may miss or misidentify constructs. Use full mode when exact source is required. Compression depends on the input and has no guaranteed ratio.

Enhanced Features

1. Better Component Detection

  • Automatically detects classes, interfaces, functions, and variables
  • Extracts class hierarchies and interface implementations
  • Identifies public, private, and protected members

2. Code Flow Analysis

  • Detects async/await patterns
  • Identifies error handling (try/catch blocks)
  • Recognizes conditional flows and loop structures

3. Type Information

  • Extracts parameter and return types from functions and methods
  • Shows property types and visibility
  • Displays inheritance relationships

4. Design Pattern Recognition

  • Automatically identifies common patterns like:
    • Observer pattern
    • Factory methods
    • Singleton implementations
    • Inheritance and interface implementation

5. Improved Visual Representation

  • Uses consistent notation for visibility (+public, -private, #protected)
  • Shows type prefixes (C=class, I=interface, F=function, V=variable)
  • Hierarchical display of component relationships

Example Output

// PATH: src/services/taskManager.ts [TYPESCRIPT]
// DESC: Manages task creation, deletion and status updates
// DEPS: vscode, fs, ./models/task

EXPORT [C:1, I:1, F:2]

C+ TaskManager implements ITaskService {
  // Main task management service
  [FLOW: error-handling→async-await]
  
  -V tasks:Map<string, Task> {
    // Property tasks
  }
  
  +F createTask(name:string, priority:TaskPriority):Promise<Task> {
    // Creates a new task
    [FLOW: conditional→try-catch]
  }
  
  +F deleteTask(id:string):Promise<boolean> {
    // Deletes a task by ID
    [FLOW: async-await→conditional]
  }
}

I+ ITaskService {
  // Task service interface
  F createTask(name:string, priority:TaskPriority):Promise<Task> {
    ...
  }
  F deleteTask(id:string):Promise<boolean> {
    ...
  }
}

PATTERNS:
- Async/Promise pattern
- Interface implementation pattern

Usage

To use the improved Micro Export format, you can:

  1. Right-click on a file/folder and select "Export Selected as Micro Codebase"
  2. Use the command palette and select "Export Micro Codebase" for the entire workspace

This feature is particularly useful for:

  • Project onboarding for new team members
  • Documentation generation
  • Understanding complex codebases
  • Creating high-level architectural overviews