Skip to content

Commit 873ac52

Browse files
committed
feat(tests): add comprehensive test suite for extension functionality
- Implemented `runTest.js` and `runTest.ts` to facilitate running integration tests. - Created test suites for extension activation and command registration in `extension.test.js` and `extension.test.ts`. - Developed file processing tests in `fileProcessing.test.js` and `fileProcessing.test.ts` to validate supported file extensions and large file detection. - Added markdown generation tests in `markdownGeneration.test.js` and `markdownGeneration.test.ts` to ensure correct folder structure and metadata extraction. - Introduced a mock file system in `mockFileSystem.js` and `mockFileSystem.ts` for simulating file operations during tests. - Configured TypeScript settings for test files in `tsconfig.json` to ensure proper compilation and module resolution.
1 parent ae1ac07 commit 873ac52

23 files changed

+2992
-71
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
/node_modules
2-
/out
2+
/out
3+
/.vscode
4+
.vscode-test
5+
commit_log.json

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,21 @@
55

66
**CodebaseMD** is a Visual Studio Code extension that allows you to export your entire codebase or selected files as a Markdown file, making it easier to share and document your projects.
77

8+
## What's New in Version 2.0.2
9+
10+
- **Enhanced Micro Export Format**: Improved code structure analysis with detection of class properties, methods, and function patterns
11+
- **Automatic Flow Detection**: Identify code flow patterns (async/await, try/catch, conditionals)
12+
- **Improved Component Representation**: Detailed component visualization with visibility indicators and type annotations
13+
- **Comprehensive Test Suite**: Added extensive test framework to ensure reliability
14+
- Check the full [release notes](releases/RELEASE-NOTES-2.0.2.md) for more details
15+
816
## Features
917

1018
- **1-Click Export Entire Codebase as Markdown**: Export your entire project into a single markdown file with the folder structure and code files included.
1119
- **Exclude Unnecessary Files Automatically**: Automatically excludes files and folders like those in `.gitignore`, `node_modules`, `build`, `out`, and large files such as `package-lock.json`.
1220
- **Export Selected Files**: Right-click on selected files or folders and export only those to Markdown.
1321
- **Markdown Compatible Output**: Only actively coded files with supported extensions (e.g., `.js`, `.ts`, `.py`, `.html`, etc.) are included with their contents, while unsupported files are listed with their names and paths.
22+
- **Micro Export Format** (New in v2.0): Generate condensed representations of your code with intelligent structure analysis, code flow detection, and design pattern recognition. [Learn more](docs/micro-export-format.md).
1423

1524
## Installation
1625

@@ -38,6 +47,12 @@ You can install **CodebaseMD** directly from the [Visual Studio Marketplace](htt
3847
- In the **Explorer** view, select multiple files or folders.
3948
- Right-click and choose **Export Selected as Markdown**.
4049

50+
### 3. Use the Micro Export Format
51+
52+
- Open the **Command Palette** (`Ctrl+Shift+P` or `Cmd+Shift+P`).
53+
- Search for and run the command **Export Micro Codebase**.
54+
- Alternatively, right-click on files or folders and choose **Export Selected as Micro Codebase**.
55+
4156
### Example of Exported Markdown
4257

4358
The exported markdown file will have:

docs/changelog.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [2.0.2] - 2025-05-22
11+
12+
### Added
13+
- Comprehensive test suite with Mocha for ensuring code quality
14+
- Enhanced Micro Export format with improved code structure analysis
15+
- Automatic detection of code flow patterns (async/await, try/catch, conditionals)
16+
- Better component representation with visibility indicators
17+
- Detailed documentation for the Micro Export format
18+
19+
### Fixed
20+
- Issues with file type detection and language mapping
21+
- Various edge cases in folder structure generation
22+
- Pattern detection for different programming paradigms
23+
- Extraction of file metadata
24+
25+
### Changed
26+
- Improved TypeScript configuration
27+
- Enhanced code organization and documentation
28+
1029
## [2.0.1] - 2025-03-24
1130

1231
### Fixed

docs/micro-export-format.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# CodebaseMD Extension v2.0.2
2+
3+
## Micro Export Format Improvements
4+
5+
The 2.0.2 release brings significant improvements to the Micro Export format, providing a more detailed and structured view of your codebase. The goal is to give you a quick but comprehensive understanding of each file's structure and purpose without diving into the full code.
6+
7+
### Enhanced Features
8+
9+
#### 1. Better Component Detection
10+
- Automatically detects classes, interfaces, functions, and variables
11+
- Extracts class hierarchies and interface implementations
12+
- Identifies public, private, and protected members
13+
14+
#### 2. Code Flow Analysis
15+
- Detects async/await patterns
16+
- Identifies error handling (try/catch blocks)
17+
- Recognizes conditional flows and loop structures
18+
19+
#### 3. Type Information
20+
- Extracts parameter and return types from functions and methods
21+
- Shows property types and visibility
22+
- Displays inheritance relationships
23+
24+
#### 4. Design Pattern Recognition
25+
- Automatically identifies common patterns like:
26+
- Observer pattern
27+
- Factory methods
28+
- Singleton implementations
29+
- Inheritance and interface implementation
30+
31+
#### 5. Improved Visual Representation
32+
- Uses consistent notation for visibility (+public, -private, #protected)
33+
- Shows type prefixes (C=class, I=interface, F=function, V=variable)
34+
- Hierarchical display of component relationships
35+
36+
### Example Output
37+
38+
```typescript
39+
// PATH: src/services/taskManager.ts [TYPESCRIPT]
40+
// DESC: Manages task creation, deletion and status updates
41+
// DEPS: vscode, fs, ./models/task
42+
43+
EXPORT [C:1, I:1, F:2]
44+
45+
C+ TaskManager implements ITaskService {
46+
// Main task management service
47+
[FLOW: error-handlingasync-await]
48+
49+
-V tasks:Map<string, Task> {
50+
// Property tasks
51+
}
52+
53+
+F createTask(name:string, priority:TaskPriority):Promise<Task> {
54+
// Creates a new task
55+
[FLOW: conditionaltry-catch]
56+
}
57+
58+
+F deleteTask(id:string):Promise<boolean> {
59+
// Deletes a task by ID
60+
[FLOW: async-awaitconditional]
61+
}
62+
}
63+
64+
I+ ITaskService {
65+
// Task service interface
66+
F createTask(name:string, priority:TaskPriority):Promise<Task> {
67+
...
68+
}
69+
F deleteTask(id:string):Promise<boolean> {
70+
...
71+
}
72+
}
73+
74+
PATTERNS:
75+
- Async/Promise pattern
76+
- Interface implementation pattern
77+
```
78+
79+
### Usage
80+
81+
To use the improved Micro Export format, you can:
82+
83+
1. Right-click on a file/folder and select "Export Selected as Micro Codebase"
84+
2. Use the command palette and select "Export Micro Codebase" for the entire workspace
85+
86+
This feature is particularly useful for:
87+
- Project onboarding for new team members
88+
- Documentation generation
89+
- Understanding complex codebases
90+
- Creating high-level architectural overviews

0 commit comments

Comments
 (0)