Code Bundler
Bundle selected project files and folders into one structured AI-friendly file, ask an AI to return a standardized CHANGE bundle, and review the applied result directly in VS Code.
Main Features
AI-Friendly Project Bundling
- Select multiple files, folders, or a mixed selection.
- Recursively scan selected folders.
- Detect UTF-8 and UTF-16 text files.
- Skip binary files and common generated directories.
- Preserve every included file as a complete file.
- Include a project tree, file index, language, size, and SHA-256 metadata.
- Add instructions asking AI tools to read the complete attachment with Python or equivalent tools.
- Generate a stable content-based bundle ID from the selected file paths and contents.
- Name generated bundles
code-bundle-<bundle-id>.txt.
- Keep the same bundle ID when the selected paths and contents have not changed.
- Record the required matching
code-change-<bundle-id>.txt name in the bundle.
- Copy the generated bundle file to the system clipboard.
Bundle Queue
- Add files or folders to a persistent bundle queue from the Explorer or an editor tab context menu.
- Add multiple Explorer selections to the queue in one action.
- Deduplicate queued items automatically.
- Display the queued item count in the status bar.
- Click the status bar item to bundle queued items, view or remove queue entries, or clear the queue.
- Restore the queue when the workspace is reopened.
Automatic CHANGE File Detection
- Detect any local file containing both
<<<BEGIN_CHANGE and <<<END_CHANGE markers when it is opened in VS Code, regardless of its file name or whether it is inside the current workspace.
- Ask whether to apply the CHANGE file to the current workspace.
- Apply the selected CHANGE file and start the existing review workflow when the user chooses Apply.
- Close the opened CHANGE-file tab automatically after Apply succeeds, whether Apply was started from the prompt or manually.
- Keep the CHANGE-file tab open when Apply fails.
- Leave the file open normally without applying changes when the user chooses Open Normally or dismisses the prompt.
Apply and Review AI Changes
- Apply
modify, create, delete, and rename operations.
- Validate source-file SHA-256 values before applying changes.
- Review changes by file or individual hunk.
- Accept or reject the current file.
- Accept or reject individual hunks through CodeLens.
- Accept or reject all remaining changes in the review session.
- Preview changes through editor decorations, hover details, and a dedicated Diff view.
- Display a ✦ marker on pending files and their parent folders in the Explorer.
- Use the AI Changed Files Explorer view to list pending files and switch files with one click.
- Navigate between pending hunks and starred files from editor actions.
- Restore rejected changes automatically.
Installation and Requirements
- Install the extension in VS Code.
- Open a folder or workspace containing the project you want to work with.
- VS Code 1.125.0 or newer is required.
Usage Guide
1. Create a Project Bundle
From the Explorer
- Open the VS Code Explorer.
- Select one or more files, folders, or both.
- Right-click the selection.
- Choose Code Bundler: Pack Selected Files and Folders.
- Wait for the operation to finish.
Code Bundler creates code-bundle-<bundle-id>.txt in the workspace root. The bundle ID is derived from the selected file paths and contents, so repeated packaging keeps the same ID until that input changes. The generated file is also copied to the system clipboard when supported.
Without an Explorer Selection
- Open the Command Palette.
- Run Code Bundler: Pack Selected Files and Folders.
- Choose the files or folders from the picker.
- Wait for
code-bundle-<bundle-id>.txt to be generated.
2. Build a Bundle Queue
Use the queue when the files and folders you want to package are selected at different times:
- In the Explorer or an editor tab, right-click a file or folder.
- Choose Code Bundler: Add to Bundle Queue.
- Repeat for other items. Duplicate paths are ignored.
- Check the queued item count in the status bar.
- Click the status bar item and choose one of these actions:
- Bundle Queued Items to create a bundle from the whole queue.
- View or Remove Queued Items to inspect the queue and remove selected entries.
- Clear Bundle Queue to remove every queued entry.
The queue is saved for the current workspace and restored when that workspace is reopened.
3. Send the Bundle to an AI Assistant
- Paste or attach
code-bundle-<bundle-id>.txt in an AI chat that supports file attachments.
- Describe what you need, such as:
- Analyze the project architecture.
- Explain how a feature works.
- Find the cause of a bug.
- Add or modify a feature.
- For code changes, ask the AI to follow the AI Editing Response Protocol contained in the bundle.
- Ask the AI to return the matching downloadable
code-change-<bundle-id>.txt file.
Example request:
Read the complete attached bundle using Python or equivalent file tools.
Add the requested feature and follow the AI Editing Response Protocol in the bundle.
Return the result as a downloadable plain-text CHANGE file.
4. Save the AI Response
Save the returned CHANGE content using the code-change-<bundle-id>.txt name specified in the bundle. Do not remove or manually alter these markers:
<<<BEGIN_CHANGE ...>>>
...
<<<END_CHANGE path="src/example.ts">>>
For modified, deleted, or renamed files, the original_sha256 value must match the current source file. If the source file changed after bundling, generate a new bundle and ask the AI to create a new CHANGE file.
5. Apply the CHANGE Bundle
Automatically When Opening a CHANGE File
- Open any local file containing both
<<<BEGIN_CHANGE and <<<END_CHANGE markers in VS Code. Its file name and workspace location do not affect detection.
- When prompted, choose Apply to apply it to the current workspace and begin the normal review flow. After a successful Apply, the CHANGE-file tab closes automatically.
- Choose Open Normally, or dismiss the prompt, to keep the file open without applying it.
From the Explorer
- Locate the returned
.txt CHANGE file.
- Right-click it.
- Choose Code Bundler: Apply Change Bundle.
- Code Bundler validates the bundle and applies the supported operations. After a successful Apply, the CHANGE-file tab closes automatically; if Apply fails, it remains open.
From the Command Palette
- Run Code Bundler: Apply Change Bundle.
- Select the CHANGE
.txt file.
- Wait for the review session to start.
6. Review Applied Changes
After Apply succeeds:
- Affected files are updated in the workspace.
- The AI Changed Files view appears in the Explorer while the review is active.
- Pending files display a ✦ marker in the Explorer.
- Changed areas are decorated in the editor.
- CodeLens actions appear near reviewable change hunks.
You can review changes in three ways.
Switch Between Pending Files
Use the AI Changed Files view at the bottom of the Explorer:
- Every file that still has pending changes appears in the list.
- Select a file to open it in the editor.
- The list refreshes automatically when a file is fully accepted or rejected.
- The view is available only while a review session is active.
Use the editor navigation actions to move between pending hunks or starred files. Use Open Current Diff to compare original and proposed content.
Review an Individual Hunk
Use the CodeLens actions above a change block:
- Accept keeps that hunk.
- Reject restores the original content for that hunk.
The file remains pending while it still contains unresolved hunks.
Review the Current File
Use the editor title actions or Command Palette:
- Accept Current Change keeps all remaining changes in the current file.
- Reject Current Change restores the file to its original state.
The Explorer ✦ marker disappears after the entire file is accepted or rejected.
Review the Entire Session
Use the Command Palette or editor actions:
- Accept All Changes keeps all pending files.
- Reject All Changes restores all pending files.
7. Understand Review Status
| Status |
Meaning |
| Explorer file or parent folder has ✦ |
The file, or a file inside that folder, still has pending AI changes. |
| CodeLens actions are visible |
The hunk can still be accepted or rejected. |
| ✦ disappears |
The entire file has been accepted or rejected. |
| Review session ends |
No pending files remain. |
8. If Apply Fails
Check the error message and verify:
- The selected file contains valid CHANGE markers.
- The operation is
modify, create, delete, or rename.
- File paths are relative to the workspace.
original_sha256 matches the current source file where required.
- The source files have not changed since the matching bundle was generated.
- Another review session is not already active.
If the project changed after generating the bundle, create a fresh bundle and request a new CHANGE file.
Each bundled source file uses this structure:
<<<BEGIN_FILE path="src/example.ts" language="typescript" size="2.1 KB" sha256="...">>>
complete file content
<<<END_FILE path="src/example.ts">>>
The generated bundle also contains:
Bundle identity metadata and the required matching change-file name
High-priority AI task instructions
Bundle overview and scope
Packed file index
Project file tree
Complete file contents
AI Editing Response Protocol
Skipped item information
End-of-bundle marker
Supported operations:
modify
create
delete
rename
Example modification:
<<<BEGIN_CHANGE operation="modify" path="src/example.ts" original_sha256="...">>>
complete resulting file content
<<<END_CHANGE path="src/example.ts">>>
The protocol inside code-bundle-<bundle-id>.txt is the authoritative definition for each operation. Each END_CHANGE marker must include a path matching its corresponding BEGIN_CHANGE marker.
Included and Skipped Content
Code Bundler includes source code, configuration, scripts, Markdown, JSON, YAML, XML, and other detected text files.
It skips common binary formats and generated or dependency directories, including:
node_modules
.git
dist
out
build
coverage
.vscode-test
.next
.nuxt
.turbo
.cache
target
Generated code-bundle-*.txt and code-change-*.txt files are excluded from subsequent bundles.
Clipboard Support
File clipboard copying is supported on Windows and macOS. If clipboard copying is unavailable or fails, bundle generation still completes and reports the clipboard status.
License
MIT
Acknowledgements
Inspired by Kevin Yang.