Code Cartographer
Code Cartographer is a powerful VS Code extension that automatically generates comprehensive documentation of your codebase, optimized for providing context to Large Language Models (LLMs).
Features
- Project Documentation: Generate detailed file structure and content documentation
- Flexible Configuration: Use a dedicated configuration file to control what gets documented
- Intelligent Filtering: Skip binary files, generated code, and large files automatically
- Multiple Output Formats: Choose between JSON, TXT, and CSV outputs
- Interactive Views: Preview generated documentation in a rich interactive view
- Quick Project Analysis: Get a quick overview of your project's structure and file distribution
- Enhanced Debugging: Comprehensive logging to help diagnose issues
Why Use Code Cartographer with LLMs
Code Cartographer was designed with LLM workflows in mind:
- Optimized Context: Generate documentation that fits within LLM context windows
- Better Comprehension: Help LLMs understand your codebase structure and relationships
- Efficient Interaction: Get more accurate code suggestions by providing complete project context
- Focused Documentation: Include only the files and code that matter using flexible configuration
Getting Started
Installation
Install from the VS Code Marketplace or:
- Press
Ctrl+P
(or Cmd+P
on Mac)
- Type
ext install pi22by7.code-cartographer
Quick Start
- Right-click on a project folder in the explorer
- Select "Generate Documentation"
- Choose your output location
- View the generated documentation
Using a Configuration File
For more control over what gets documented, create a configuration file:
- Right-click on a project folder in the explorer
- Select "Create Config File" to generate a
cartographer.config.json
file
- Customize the patterns for included and excluded files
- Run "Generate Documentation" to use your custom configuration
Configuration
Configuration File
The recommended way to configure Code Cartographer is with a cartographer.config.json
file in your project root. This gives you precise control over what gets documented:
{
"version": "1.0",
"include": [
"src/**/*",
"*.json",
"*.md"
],
"exclude": [
"**/*.min.js",
"**/*.test.ts",
"node_modules/**",
".git/**",
"dist/**"
],
"maxFileSize": 500000,
"skipBinaryFiles": true,
"skipGeneratedFiles": true,
"customFiles": {
"large-important-files": {
"include": ["src/some-important-file.ts"],
"maxSize": 2000000
}
},
"documentation": {
"type": "both",
"format": "json",
"outputPath": "./documentation.json"
}
}
You can also configure the extension through the VS Code settings UI:
- Go to the Command Palette (
Ctrl+Shift+P
or Cmd+Shift+P
on Mac)
- Type "Code Cartographer: Configure Settings"
- Use the form interface to adjust your configuration
Configuration Options
Option |
Description |
include |
Glob patterns for files to include |
exclude |
Glob patterns for files to exclude |
maxFileSize |
Maximum file size in bytes to include |
skipBinaryFiles |
Automatically skip binary files |
skipGeneratedFiles |
Skip files that appear to be machine-generated |
customFiles |
Special rules for specific files (overrides default settings) |
documentation.type |
Type of documentation to generate (structure , documentation , or both ) |
documentation.format |
Output format (json , txt , or csv ) |
documentation.outputPath |
Path where to save documentation |
Commands
Code Cartographer provides several commands available from the Command Palette (Ctrl+Shift+P
or Cmd+Shift+P
on Mac):
- Generate Documentation: Creates comprehensive documentation for your project
- View Documentation: Opens an existing documentation file in the viewer
- Configure Settings: Opens the configuration UI
- Create Config File: Generates a default configuration file in your project root
- Quick Analyze Project: Provides a fast overview of your project structure
- Show Logs: Opens the extension logs for troubleshooting
Troubleshooting
If you encounter issues with Code Cartographer, here are some steps to try:
- Enable Debug Mode: Set
codeCartographer.debugMode
to true
in your VS Code settings
- Check the Logs: Run the "Show Logs" command to view detailed diagnostic information
- Verify Configuration: Make sure your
cartographer.config.json
file or VS Code settings have the correct format and values
- Review Exclusions: If files are missing, check that they aren't being excluded by your configuration
Common problems and solutions:
- No files documented: Check your include/exclude patterns and make sure they match your project structure
- Large files skipped: Increase the
maxFileSize
value or use customFiles
to allow specific large files
- Crashes on large projects: Try documenting smaller parts of your project first, then increase scope
Release Notes
0.3.0 - Enhanced Configuration
- Added support for
cartographer.config.json
configuration files
- New configuration UI for easy setup
- Improved file filtering with custom file overrides
- Enhanced documentation viewer
- Added debug mode with detailed logging
- Fixed issues with large repositories
- Added quick project analysis feature
0.2.1
- Fixed issue where the extension would generate empty documentation with no files
- Improved directory traversal to better handle large projects
- Enhanced file structure display with proper path tracking
- Made .gitignore parsing more robust (won't fail if file is missing)
- Added better error handling during file processing
- Improved performance by skipping ignored directories early
- Added detailed logging for troubleshooting
0.1.0
- Initial release
- Generate documentation for your codebase in JSON, TXT or CSV format
- Support for file structure and content documentation
- Integration with .gitignore to exclude unwanted files
- Opens the generated document upon clicking 'View Documentation'