olegcat
Описание
Языки
- TypeScript97,5%
- JavaScript2,5%
Olegcat File Merger
Olegcat File Merger is a Visual Studio Code extension designed to concatenate multiple files from your workspace into a single, structured output file. This is particularly useful for preparing large code contexts for Large Language Models (LLMs), creating comprehensive project snapshots, or any scenario where you need a combined view of various project files.
The extension uses a simple configuration file named (by default) in your project root to determine which files to include or exclude, based on glob-like patterns.
License
All the code is licensed under the Universal Permissive License. See LICENSE.md for more details.
Features
- Pattern-Based File Selection: Define precisely which files to include or exclude using an
configuration file..olegcat - Glob-like Patterns: Supports common wildcards (
,*) and recursive directory matching (?) for flexible file matching.** - Project Structure Overview: The merged output automatically includes a text-based representation of your project's directory structure (for the included files).
- Metadata Header: The output file begins with a header containing:
- Project Name
- Creation Timestamp
- Project Root Path
- Include Patterns Used
- Exclude Patterns Used
- Context Menu Integration:
- Right-click on files/folders in the Explorer to merge them directly.
- Right-click on an
file to merge based on its configuration..olegcat
- Command Palette Access: All functionalities are available through the VS Code Command Palette.
- Default Configuration Generation: Easily generate a starter
file with common defaults..olegcat - Syntax Highlighting Hints: The merged file uses Markdown code blocks with language identifiers for better readability.
How it Works
-
Create or Generate
:.olegcat- Manually create a file named
in the root of your workspace..olegcat - Or, use the command
to create one with pre-filled common patterns.Olegcat: Generate Default .olegcat Config File
- Manually create a file named
-
Define Patterns:
- Edit the
file to specify your include and exclude patterns..olegcat - See the
File Format section below for details..olegcat
- Edit the
-
Merge Files:
- Use one of the available Commands to initiate the merge process.
- The merged content will be opened in a new editor tab. You'll be prompted if you want to save it.
.olegcat File Format
The file is a plain text file where each line defines a pattern or is a comment.
- Comments: Lines starting with
are ignored.# - Include Patterns: Any line that is not a comment and does not start with
is an include pattern.!- Examples:
,*.ts,src/**/*.pydocs/README.md
- Examples:
- Exclude Patterns: Lines starting with
are exclusion patterns. These take precedence over include patterns.!- Examples:
,!node_modules/,!dist/,!*.log!**/*.test.ts
- Examples:
- Wildcards:
: Matches any sequence of characters except path separators (*)./: Matches any single character except path separators.?: Matches any sequence of characters including path separators (for recursive directory matching). Usually used like**.src/**/*.js
- Directory Matching: Patterns ending with a
(e.g.,/) are typically used to match directories.dist/
Example file:
# This is a comment
# Include all TypeScript files
*.ts
# Include all Python files within the 'src' directory and its subdirectories
src/**/*.py
# Include HTML files from the 'public' directory
public/*.html
# Exclude the node_modules directory
!node_modules/
# Exclude all .map files
!*.map
# Exclude temporary files
!temp/
!*.tmp
Commands
Access these commands via the Command Palette ( or ):
- Olegcat: Merge Selected Files/Folders
- Merges the files and/or folders currently selected in the VS Code Explorer.
- If an
file exists in the workspace root, its exclusion patterns will be respected. Selected files will be included if they match include patterns or if no include patterns are defined in the config..olegcat
- Olegcat: Merge Files from Config
- Merges files based on the patterns defined in the
file..olegcat - If invoked via the context menu on an
file, that specific file is used..olegcat - If invoked from the command palette, it looks for
in the workspace root..olegcat
- Merges files based on the patterns defined in the
- Olegcat: Generate Default .olegcat Config File
- Creates a new
file in the workspace root with a set of common default include and exclude patterns..olegcat - If the file already exists, it will ask for confirmation before overwriting.
- Creates a new
Development
Building from Source
- Clone the repository
- Run
to install dependenciesnpm install - Run
to build the extensionnpm run compile - Press
to open a new Extension Development Host windowF5
1. Install Publishing Tools
2. Set Up Publishing Credentials
For VS Code Marketplace:
- Create a Personal Access Token at Azure DevOps
- Login with vsce: vsce login your-publisher-name
For OpenVSX:
- Get an access token from Open VSX Registry
- Login with ovsx:
(if needed)ovsx create-namespace your-publisher-name
3. Update Publisher Information
Before publishing, update these fields in :
: Your publisher name/IDpublisher: Your GitHub repository URLrepository.url: Increment version number for each releaseversion
4. Publishing Commands
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request