A Visual Studio Code extension that reads your local project structure and generates a single codecontext.txt file containing the visual folder hierarchy and the raw text contents of your files.
This tool is designed to quickly bundle codebase context so it can be passed into Large Language Models (LLMs) or local AI assistants without the need to manually copy and paste multiple files.
- Visual Folder Tree: Generates an ASCII-style directory structure at the top of the text file.
- Targeted Generation: Run the command on an entire workspace, or right-click a specific subfolder to generate context exclusively for that directory.
- Smart Filtering: Bypasses heavy dependency directories (
node_modules,.git) and build folders (dist,out). - Binary Exclusion: Automatically skips non-text files (images, PDFs, ZIPs) to keep the text output clean.
- .gitignore Support: Reads your workspace
.gitignorefile and applies those rules to the generation process.
The generated codecontext.txt file will look like this:
simplehtml/
|
-index.html
|
-script.js
|
-style.css
simplehtml/index.html:
---------------------
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>Animated Countdown</title>
</head>
<body>
<div class="counter">
<div class="nums">
<span class="in">3</span>
<span>2</span>
<span>1</span>
<span>0</span>
</div>
<h4>Get Ready</h4>
</div>
</body>
</html>
simplehtml/script.js:
--------------------
const nums = document.querySelectorAll('.nums span')
const counter = document.querySelector('.counter')
function resetDOM() {
counter.classList.remove('hide')
nums.forEach((num) => {
num.classList.value = ''
})
nums[0].classList.add('in')
}
-
Download the latest
.vsixfile from the Releases page. -
Open VS Code.
-
Open the Extensions view (
Ctrl+Shift+XorCmd+Shift+X). -
Click the
...menu at the top right of the Extensions panel. -
Select
Install from VSIX...and choose the downloaded file.
If you want to modify the extension or run it locally:
-
Clone the repository:
Bash
git clone [https://github.com/parthamk/code-context-generator.git](https://github.com/parthamk/code-context-generator.git) -
Navigate to the project directory and install dependencies:
Bash
cd code-context-generator npm install -
Open the folder in VS Code.
-
Press
F5to open a new VS Code window with the extension loaded in debug mode.
Right-Click Menu (Context Menu)
-
Open the File Explorer in VS Code.
-
Right-click on any folder you want to analyze.
-
Select
Generate Code Context. -
The
codecontext.txtfile will be created inside that specific folder.
Command Palette
-
Open the Command Palette (
Ctrl+Shift+Pon Windows/Linux,Cmd+Shift+Pon macOS). -
Type
Generate Code Contextand press Enter. -
The
codecontext.txtfile will be created in the root of your current workspace.
To prevent sensitive data or massive files from crashing the context generation, the extension uses a hardcoded base ignore list alongside your .gitignore rules.
The base ignore list includes:
-
.git,node_modules,.vscode -
dist,out -
codecontext.txt -
.env,.env.local,.env.development,.env.production
If you need to ignore additional files, add them to your project's .gitignore file.
Contributions, issues, and feature requests are welcome.
-
Fork the project.
-
Create your feature branch (
git checkout -b feature/NewFeature). -
Commit your changes (
git commit -m 'Add some NewFeature'). -
Push to the branch (
git push origin feature/NewFeature). -
Open a Pull Request.
This project is licensed under the GNU General Public License. See the LICENSE file for details.
Partha
- Website: codeweez.in