Repo2Clip is a Visual Studio Code extension that helps developers share codebase context with Large Language Models (LLMs) by providing formatted directory structures and file contents.
Copies a clean directory tree structure to your clipboard - perfect for giving LLMs context about your project organization without overwhelming them with implementation details.
Captures both the directory structure and the contents of all files in your workspace. Useful for in-depth code reviews or when you need to share comprehensive context.
Provides the full directory structure of your workspace but only includes file contents from the selected folder and all its subfolders. This means:
- You get the complete tree view of your entire workspace for context
- File contents are included only for:
- Files in the selected folder
- Files in all subfolders of the selected folder
- Files matching your
alwaysIncludedpatterns
- Visual Studio Code 1.80.0 or higher
- Node.js 16.x or higher
- npm 7.x or higher
- Open VS Code
- Open Command Palette (
Ctrl+Shift+PorCmd+Shift+P) - Type "Extensions: Install from VSIX..."
- Select the repo2clip.vsix file
Or install from the VS Code Marketplace [coming soon]
- Open Command Palette (
Ctrl+Shift+PorCmd+Shift+P) - Type "Repo2Clip" to see available commands:
Repo2Clip: Copy Repository Structure OnlyRepo2Clip: Copy Complete WorkspaceRepo2Clip: Copy Workspace (Selected Folder Contents)
Right-click on any folder in the Explorer to access Repo2Clip commands.
Repo2Clip uses .gitignore pattern syntax for both inclusion and exclusion rules. Patterns are matched against file paths relative to the workspace root.
*matches any characters except/**matches any characters including/?matches a single character except/!negates a pattern/matches directory separators- Lines starting with
#are comments
{
"repo2clip.alwaysIncluded": [
// Documentation
"**/*.md", // All markdown files
"docs/**/*.{md,txt}", // All docs in markdown or text
// Configuration
"**/config.*", // Any config file
"**/*.config.{js,json,ts}", // All config files with specific extensions
// Source code
"src/**/*.{ts,tsx}", // All TypeScript files under src
"!src/**/*.test.ts", // Exclude test files
// API definitions
"api/**/*.{yaml,json}", // All API specs
// Important project files
"package.json",
"**/tsconfig.json"
]
}-
Include/Exclude Priority:
alwaysIncludedpatterns take highest precedence.gitignoreandalwaysExcludedpatterns are combined- When conflicts occur, inclusion wins and a warning is shown
-
File Order:
- README.md files always appear first
- Other included files appear in the order of matching patterns
- Regular files appear after the directory structure
[
"readme.md",
"package.json",
"requirements.txt",
"pyproject.toml",
"cargo.toml",
"go.mod",
"gemfile",
"composer.json",
"build.gradle",
"pom.xml"
][
// Build artifacts
"**/*.pyc",
"**/*.exe",
"**/*.dll",
"**/*.so",
// System files
"**/.DS_Store",
"**/Thumbs.db",
// Dependencies
"**/node_modules/**",
"**/venv/**",
// Build outputs
"**/dist/**",
"**/build/**"
// Full list in package.json
]-
Pattern Organization
- Group patterns by purpose (docs, config, source, etc.)
- Use comments to explain complex patterns
- Start with more specific patterns before general ones
-
Performance
- Be specific with include patterns to avoid processing unnecessary files
- Use
maxFileSizeto prevent large file processing - Consider using
Copy Workspace (Selected Folder Contents)for large repos
-
Security
- Review copied content before sharing with LLMs
- Add sensitive file patterns to
alwaysExcluded - Use
.gitignorein conjunction with extension patterns
-
Files Not Being Included
- Check pattern syntax
- Verify file isn't matched by exclude patterns
- Check file size against
maxFileSize
// Make pattern more specific "repo2clip.alwaysIncluded": ["src/specific/path/**/*.ts"]
-
Performance Issues
- Reduce scope of include patterns
- Increase exclude patterns
- Use selected folder copy instead of complete workspace
// Optimize patterns "repo2clip.alwaysExcluded": ["**/node_modules/**", "**/dist/**"]
-
Pattern Conflicts
- Review warning messages
- Make patterns more specific
- Check pattern order in arrays
// Fix conflicts "repo2clip.alwaysIncluded": ["src/**/*.ts", "!src/**/*.test.ts"]
Here's my project structure and relevant files:
[Paste clipboard content here]
Can you help me understand...
The extension formats output to be easily readable by both humans and LLMs, with clear separation between directory structure and file contents.
- Initial release
- Pattern-based file inclusion/exclusion
- Gitignore integration
- Priority file handling
- Conflict detection and warning system
- Directory structure visualization
- Selected folder content support
{ // Files to always include (using .gitignore pattern syntax) "repo2clip.alwaysIncluded": [ "readme.md", "**/*.config.{js,json}", "src/**/*.{ts,tsx}" ], // Files to always exclude "repo2clip.alwaysExcluded": [ "**/node_modules/**", "**/*.test.{ts,js}", "**/dist/**" ], // Maximum file size in bytes "repo2clip.maxFileSize": 1000000 }