Tree Builder DocumentationTree Builder is a VS Code extension for turning selected files and folders into structured context packages. The generated result can be copied to the clipboard or opened as a new editor document, making it useful for AI prompts, code reviews, project overviews, and technical documentation. Contents
Quick Start
Tree Builder discovers files recursively, removes duplicate nested selections, applies the template's include and exclude patterns, builds a deterministic directory tree, and renders the final context. Ways to Build ContextFrom the ExplorerSelect a file, folder, or multiple resources in the Explorer, then open the context menu. Use one of these commands:
The same commands work for a mixed selection of files and folders. When a folder and one of its children are both selected, the nested selection is automatically pruned.
From the active editorWith a file open, right-click inside the editor and choose Build Tree Context. This builds context from the active file or the editor's current resource, depending on the available workspace selection.
From the Command PaletteOpen the Command Palette with
Choosing a TemplateUse Build Tree Context with Template... whenever the output format should differ from the default. The picker shows each template's name, description, output target, content mode, and common-path behavior.
The output target is controlled by the selected template:
Managing TemplatesRun Tree Builder: Manage Templates from the Command Palette. The Template Manager provides:
Built-in templates are read-only. Duplicate one before customizing it.
The editor supports separate include and exclude glob patterns. Enter one pattern per line. You can also add common exclude presets such as
Wrapper templateThe wrapper is rendered once for the complete result. It usually places the generated tree and rendered file blocks into a larger Markdown document. Supported wrapper variables:
Per-file templateThe per-file template is rendered once for every included file.
Built-in TemplatesTree Builder includes these templates:
The default built-in template is AI Context. Built-in filters exclude common generated and dependency directories such as Generated OutputThe generated context contains a deterministic tree with directories before files and alphabetical ordering. Depending on the selected template, file contents are wrapped in language-aware Markdown code blocks.
Tree Builder protects the generation process in two ways:
Cancellation is available while a large selection is being scanned or rendered. SettingsOpen VS Code Settings with
DevelopmentRequirements
Install and build
For continuous rebuilding during development:
Tests and type checking
Package the extension
The command creates a TroubleshootingNo files are generatedConfirm that a file or folder is selected in the Explorer, or that an active editor belongs to the current workspace. Tree Builder displays a warning when no files are found. Files are missing from the resultCheck the selected template's include and exclude patterns. A file can also be omitted because it is binary or larger than The default command uses an unexpected formatOpen Template Manager and check which template is marked as default. You can also set Inspecting logsOpen View: Toggle Output, then select Tree Builder from the channel list. Increase PrivacyTree Builder processes selected files locally. It does not send project contents to an external service and does not require network access during normal operation. LicenseTree Builder is distributed under the MIT License. See LICENSE for the full text. Author
Acknowledgments |