Aggregate Open Tabs
Aggregate Open Tabs is a Visual Studio Code extension that helps you gather, preview, and manage all of your open files in one place. It also provides powerful features for analyzing file contents, generating summaries, chunking large files, and filtering out sensitive or unnecessary files before sharing or reviewing.
Features
Installation
1. From the VS Code Marketplace (Recommended)
- Open Visual Studio Code.
- Go to the Extensions view (
Ctrl+Shift+X or Cmd+Shift+X on macOS).
- Search for "Aggregate Open Tabs".
- Click Install.
2. From a VSIX File (Manual)
- Download the
.vsix file from the GitHub releases page (or from a local build).
- In VS Code, open the Extensions view.
- Click on the “...”(More Actions) in the top-right corner and select Install from VSIX....
- Select the
.vsix file to install.
3. Building From Source (Advanced)
- Clone this repository.
- Run
npm install or yarn install .
- Press
F5 in VS Code to launch an Extension Development Host with the extension loaded.
Getting Started
Open the "Aggregate Open Tabs" Tree View
Aggregate Your Files
- In the Tree View, click “Aggregate # Open Files” to combine all open tabs into a single output.
- Alternatively, click “Copy to Clipboard” to copy the aggregated content to your clipboard.
Preview the Aggregation
- Click “Toggle Preview” in the Tree View to open the webview panel.
- Any changes to open files will refresh the preview automatically (with a brief delay).
Selective Aggregation
- Run the command
Aggregate Selectively (extension.selectiveAggregate ) via the Command Palette (Ctrl+Shift+P or Cmd+Shift+P ).
- A Quick Pick menu will let you choose which files to include.
Commands
Command |
Description |
extension.aggregateOpenTabs |
Aggregates content from all open files into one unified output. |
extension.selectiveAggregate |
Prompts you to select which open files to aggregate. |
extension.togglePreview |
Toggles the webview preview panel for the aggregated output. |
extension.copyAggregatedContent |
Copies the aggregated content to your clipboard. |
extension.openConfiguration |
Opens the extension’s configuration panel in a dedicated webview (alternative to using VS Code’s Settings). |
You can also access some of these commands from the Aggregate Open Tabs Tree View context menu.
Configuration
All configuration settings can be found by opening File > Preferences > Settings (or Ctrl+, ) and searching for aggregateOpenTabs .
Settings Overview
Setting Key |
Description |
aggregateOpenTabs.showPreviewOnStartup |
If true , automatically open the Preview panel when VS Code starts (default: false ). |
aggregateOpenTabs.includeFileTypes |
List of file extensions (e.g. [ ".ts", ".js" ] ). When not empty, only these file types are aggregated. Use ["*"] to include all. |
aggregateOpenTabs.chunkSize |
Maximum number of lines per chunk (default: 2000 ). Files larger than this are split into multiple chunks. |
aggregateOpenTabs.excludePatterns |
Array of glob patterns to exclude (e.g., ["**/node_modules/**", "**/.git/**"] ). |
aggregateOpenTabs.addSummaries |
If true , adds short file summaries (default: true ). |
aggregateOpenTabs.enhancedSummaries |
If true , uses AI-powered, detailed file analysis (default: true ). |
aggregateOpenTabs.extraSpacing |
If true , adds extra spacing around code blocks and sections (default: true ). |
aggregateOpenTabs.useCodeFences |
If true , wraps code chunks in fenced blocks for Markdown/HTML (default: true ). |
aggregateOpenTabs.aiSummaryStyle |
Summaries can be 'concise' or 'detailed' (default: concise ). |
aggregateOpenTabs.includeKeyPoints |
If true , includes bullet-point key findings for each file (default: true ). |
aggregateOpenTabs.includeImports |
If true , includes a list of imports for each file (default: true ). |
aggregateOpenTabs.includeExports |
If true , includes a list of exports for each file (default: true ). |
aggregateOpenTabs.includeDependencies |
If true , includes detected external package dependencies (default: true ). |
aggregateOpenTabs.tailoredSummaries |
If true , attempts to tailor the AI summary to each file’s content (default: true ). |
aggregateOpenTabs.outputFormat |
Output format of the aggregated content (plaintext , markdown , or html ). Default is markdown . |
aggregateOpenTabs.chunkSeparatorStyle |
Controls how chunks are separated (double , single , minimal ). Default is double . |
aggregateOpenTabs.codeFenceLanguageMap |
Map of language IDs to code fence labels (e.g., { "typescript": "ts" } ). |
aggregateOpenTabs.sensitiveDataHandling |
How to handle sensitive data (warn , redact , skip , or ignore ). Default is warn . |
aggregateOpenTabs.customRedactionPatterns |
Array of regex patterns for additional sensitive data redaction (e.g., ["API_KEY_\\w+", "SECRET_\\w+"] ). |
aggregateOpenTabs.openInNewWindow |
If true , aggregated content opens in a new VS Code window (default: false ). |
aggregateOpenTabs.llmFriendly |
If true , generates output optimized for LLM consumption with enhanced metadata (default: true ). |
aggregateOpenTabs.filePurposeDetection |
If true , analyzes files to determine their main purpose (default: true ). |
aggregateOpenTabs.dependencyTracking |
If true , tracks and displays file dependencies (default: true ). |
aggregateOpenTabs.directoryContext |
If true , includes directory-level context and relationships (default: true ). |
aggregateOpenTabs.yamlMetadata |
If true , formats metadata in YAML blocks for easier parsing (default: true ). |
Configuration Panel
For a more intuitive setup experience, you can open a dedicated configuration UI:
- Run the command:
Aggregate Open Tabs: Open Configuration
- A webview panel will appear with chunking, file exclusion, output settings, security, and other options.
Example Workflow
- Open Multiple Files in VS Code—various file types such as
.ts , .md , .json , etc.
- Check the Tree View (Explorer sidebar):
- View “File Statistics” for total size and language/workspace distribution.
- Expand “Open Files” to see each open file with a short analysis.
- Click “Aggregate # Open Files”:
- You’ll see a single aggregated document in the Preview or copied to your clipboard.
- The output includes enhanced metadata, file purposes, and relationships.
- Use the Preview:
- Toggle the preview in the Tree View or run
extension.togglePreview .
- Automatic refresh when you change files.
- Selective Aggregation:
- Run
extension.selectiveAggregate from the Command Palette.
- Uncheck unwanted files from the Quick Pick prompt.
LLM-Friendly Output Example
The enhanced output includes:
# Project Code Overview
## Project Structure
This document contains an aggregated view of the project's source code with enhanced metadata and analysis.
Each file is presented with its purpose, dependencies, and contextual information to aid in understanding.
## Table of Contents
- [main.ts](#main-ts) - Main entry point for the extension
- [utils.ts](#utils-ts) - Utility functions for file handling and analysis
...
## main.ts
### File Purpose
Main executable script | Defines extension activation and commands
### Directory Context
Source directory containing core extension functionality
### Dependencies
- `vscode`
- `./utils`
- `./treeView`
### Metadata
```yaml
path: src/main.ts
language: typescript
size: 2048 bytes
last_modified: 2025-01-16T00:00:00Z
Source Code
// File contents here...
## Security & Sensitive Data
- By default, the extension detects environment variables and other potential secrets.
- Configure handling under **`aggregateOpenTabs.sensitiveDataHandling`**:
- `warn`: Show a warning but still include them in aggregated content.
- `redact`: Mask out sensitive values (e.g., `SECRET_KEY` → `REDACTED`).
- `skip`: Skip lines or files containing sensitive data.
- `ignore`: Do nothing special with sensitive data.
- You can add your own **`customRedactionPatterns`** (as an array of regex patterns) to further refine redactions.
## Contributing
1. **Fork** the repository.
2. **Create** a new branch for your feature or bug fix.
3. **Commit** and push your changes with tests (if applicable).
4. **Open** a pull request, describing your modifications.
## License
This project is licensed under the [MIT License](https://github.com/hospedales/vscode-aggregate-open-tabs/blob/HEAD/LICENSE).
See the [LICENSE](https://github.com/hospedales/vscode-aggregate-open-tabs/blob/HEAD/LICENSE) file for details.
---
**Enjoy using Aggregate Open Tabs!** If you have questions, suggestions, or issues, please open a GitHub Issue or submit a PR.
Happy coding!
## Python Aggregator
A standalone Python script is now available for project-wide file aggregation. This complements the VS Code extension by providing a command-line interface that can process entire project directories, not just open tabs.
### Key Features
- Recursive directory traversal
- Multiple output formats (plaintext, markdown, HTML)
- Sensitive data detection and redaction
- Configurable file chunking
- Customizable file exclusions
- No external dependencies required
### Installation
1. Copy `python_aggregator.py` to your project directory
2. Make it executable (Unix-like systems):
```bash
chmod +x python_aggregator.py
Usage
Basic usage:
./python_aggregator.py [options]
Available options:
--root-dir PATH : Root directory to start aggregation from (default: current directory)
--output-file PATH : Output file path (default: print to stdout)
--exclude-dirs DIR1 DIR2 ... : Additional directories to exclude
--redact : Enable sensitive data redaction
--format FORMAT : Output format (plaintext/markdown/html)
--chunk-size NUM : Maximum lines per chunk (default: 2000, 0 to disable chunking)
--no-extra-spacing : Disable extra spacing in output
Examples
Aggregate all files in the current directory:
./python_aggregator.py
Save output to a file in markdown format:
./python_aggregator.py --format markdown --output-file project.md
Exclude specific directories and enable redaction:
./python_aggregator.py --exclude-dirs build dist temp --redact
Process a specific directory with custom chunk size:
./python_aggregator.py --root-dir /path/to/project --chunk-size 1000
For more detailed information about the Python script, see python_aggregator.md.
| |