Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>REPO2STRNew to Visual Studio Code? Get it now.
REPO2STR

REPO2STR

liamferrante

|
2 installs
| (1) | Free
Pack repository context for LLMs
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

REPO2STR: Secure Context Manager for VS Code

Version License Security

Stop manually copying and pasting files into ChatGPT, Claude, and DeepSeek.

REPO2STR is a professional, security-first Context Manager designed to bridge the gap between your codebase and Large Language Models. It visualizes your repository, calculates token usage in real-time, and packages your code into optimized formats (XML, Markdown) specifically tuned for modern AI context windows.


🚀 Key Features

🛡️ Enterprise-Grade Security

Designed for sensitive environments.

  • 100% Local Processing: Your code never leaves your machine until you copy/paste it. No API calls to third-party servers.
  • Strict Path Validation: Prevents path traversal attacks within the Webview.
  • Content Security Policy (CSP): Implements cryptographic nonces to prevent script injection.
  • Git Shell Protection: Safe execution of git commands preventing shell injection.

🧠 Smart Token Management (The "Eye" System)

Unique to this extension is the ability to separate file existence from file content.

  • 👁️ Open Eye: The file is fully read. The AI sees the path and the code.
  • 👁️ Slashed Eye: The file is referenced only. The AI sees the file exists in the directory tree structure but does not see the code.
    • Use Case: Show the AI your node_modules structure or images folder without wasting 10k tokens on their contents.

⚡ optimized Formats for 2025 LLMs

  • XML (Default): The gold standard for Claude 3.5 Sonnet and Opus. Uses robust <codebase_context> tags to clearly separate your code from your prompt instructions.
  • Markdown: Best for GPT-4o and DeepSeek. Uses "Dynamic Fencing" to ensure code blocks are never broken, even if your source code contains backticks.
  • Basic: A minimal path: content format for smaller models or raw text processing.

🛠️ Developer Workflow

  • Git Integration: Instantly select only your Modified or Staged files with one click.
  • Live Token Counter: Real-time token estimation (calibrated to ~3 chars/token) displayed in the footer.
  • Prompt Engineering: Built-in collapsible prompt box to prepend instructions (e.g., "Refactor these files using the Factory pattern").
  • Restore (v1): Paste/edit generated output and safely restore files back into your workspace with preview, diff, and optional backup.
  • Export Options: Copy to Clipboard, Download (.txt), or Export as .zip.

📖 How to Use

  1. Open: Right-click a folder in Explorer and select Generate Repository Context, or run repo2str.open from the Command Palette.
  2. Select:
    • Use checkboxes to select files.
    • Toggle the Eye Icon to choose between "Content" vs "Structure Only".
  3. Instruct: (Optional) Type instructions in the top bar. Click the arrow to expand/collapse the input area.
  4. Generate: Select your format (XML recommended) and click Generate.
  5. Export: Use the toolbar icons to Download, Copy, or Clear.

⚙️ Configuration

Access the Settings Panel via the gear icon in the toolbar.

Setting Description
Content Exclusion Patterns Glob patterns for files that should appear in the tree but default to "Hidden Content" (Slashed Eye). Useful for .env, package-lock.json, etc.
Hide Excluded Files If checked, files matching the patterns above will be completely removed from the view instead of just having their content hidden.
Use External Icons Toggle between lightweight offline icons (default) and rich Material Design icons (requires internet connection).

⌨️ Shortcuts & Tips

  • Drag the Sashes to resize the file tree.
  • Regex Search: Click .* in the search bar to switch from plain text to Regex mode.
  • Quick Expand: Click the arrow next to the prompt input to instantly expand it to 50% height.

REPO2STR — Your code, context-ready.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft