Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>CodePackNew to Visual Studio Code? Get it now.
CodePack

CodePack

Zenuxs

|
8 installs
| (0) | Free
Copy selected VS Code files and folders as clean, structured LLM context — fully local, private, and offline.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Local Context Exporter

Copy selected VS Code workspace files and folders as clean, structured Markdown context for LLMs — fully local, private, and offline.

Right-click a folder like src/ in the Explorer, choose Copy as LLM Context, and paste a complete directory tree plus every file's contents (in language-labeled fenced code blocks) straight into ChatGPT, Claude, Gemini, or any other LLM.

Local by default. Optional AI-assisted feature suggestions with explicit user consent.

Key features

  • Copy as LLM Context — filtered directory tree first, then every file in its own fenced code block
  • Preview LLM Context — inspect the exact output in a read-only editor tab before copying anything
  • Copy Project Tree Only — just the filtered project structure
  • Feature Context sidebar — analyze and select logical business features for targeted context export
  • AI-assisted feature suggestions — optional integration with OpenAI-compatible APIs
  • Local feature analysis — heuristic feature grouping based on project structure without AI
  • Manual feature creation — create custom feature groupings by hand
  • Dependency depth control — choose how many import hops to include
  • File relationship graph — visualize import and route-handler connections
  • Language-aware code fences (JS/TS/TSX/JSX/Python/PHP/Blade/JSON/CSS/Markdown and more), safe against broken fences
  • Configurable exclusions, extension allowlist, per-file size limits
  • .gitignore support without Git installed
  • Large-context warning with Copy Anyway / Preview Instead / Cancel
  • 100% local by default: no login, no account, no API key, no backend, no telemetry, no network requests

Installation

From source (development):

npm install
npm run compile

Press F5 in VS Code to launch an Extension Development Host, or build a VSIX with npm run package and install it via Extensions → … → Install from VSIX.

Quick start

  1. Install the extension.
  2. Open a project in VS Code.
  3. Right-click a file or folder in Explorer.
  4. Choose Copy as LLM Context.
  5. Paste the generated Markdown into your preferred LLM.

Commands

Command Purpose
Copy as LLM Context Copies tree plus selected source files as structured Markdown
Preview LLM Context Opens generated Markdown in an editor before copying
Copy Project Tree Only Copies only the filtered project structure
Analyze Project Features with AI Sends project metadata to an AI provider for feature suggestions
Analyze Features Locally Groups files into logical features using local static analysis
Preview Selected Feature Context Opens selected feature context in an editor
Copy Selected Feature Context Copies selected feature context to clipboard
Create Manual Feature Creates a custom feature by selecting files manually
Open Feature Context Opens the Feature Context sidebar

All original Explorer context-menu commands continue to work exactly as before.

Feature-aware context selection

CodePack can help organize code by logical feature, such as Authentication, Ride Booking, Missions, or Go Online.

  1. Open the CodePack sidebar (click the CodePack icon in the Activity Bar).
  2. Run local analysis or optional AI analysis.
  3. Select a feature.
  4. Review the suggested file list.
  5. Check or uncheck files.
  6. Preview or copy only the selected feature context.

Feature suggestions are not guaranteed to be complete or correct. Always review selected files before sending them to an external LLM.

Local feature analysis

Click Analyze Locally to group files into features using:

  • Directory structure
  • File naming patterns
  • Import/export relationships
  • Route definitions
  • API endpoint detection
  • Symbol names

No API key or network access is required for local analysis. Local suggestions are labelled "Local heuristic suggestion".

AI feature analysis

When AI mode is enabled, the extension can send project metadata to your configured AI provider for more intelligent feature grouping.

AI suggestions are labelled "AI suggestion — review before copying".

AI is used only for:

  • Identifying likely feature candidates
  • Grouping related code files
  • Explaining why a file belongs to a feature
  • Suggesting relevant entry points
  • Suggesting missing related files
  • Providing confidence labels

AI is never used for:

  • Reading the entire project by default
  • Copying files
  • Formatting Markdown
  • Building project trees
  • Ignoring files
  • Reading binary files
  • Accessing .env
  • Sending API keys
  • Uploading files automatically
  • Modifying user code
  • Running shell commands
  • Calling Git commands

Manual feature creation

Click + Create Manual Feature to create a custom feature:

  1. Enter a feature name
  2. Select files or folders from the workspace
  3. All eligible files are added to the feature
  4. You can preview or copy the selected context

File selection

For every feature:

  • All suggested valid files start as selected
  • You can check/uncheck each file
  • Select All and Select None buttons control bulk selection
  • Selection count is shown as "Selected: N / M files"
  • Selection is preserved while navigating between features
  • Manual files can be removed with the × button

Dependency depth control

Choose how many import hops to include:

  • Direct matches only — only the files matched by analysis
  • Include direct dependencies — adds files directly imported by selected files
  • Include dependencies of dependencies — adds second-hop imports

Cyclic imports are handled safely. node_modules and ignored files are never included.

File relationships

The sidebar shows import and route-handler relationships between selected files. Only relationships where both source and target are currently selected are displayed.

AI privacy

AI-assisted feature analysis is optional and disabled by default.

When disabled, Local Context Exporter performs no external requests.

When enabled, the extension sends only the data you explicitly approve to your configured AI provider. In Metadata Only mode, this consists of file paths, imports, exports, symbols, and route/API metadata — not full file contents.

The API key is read from process.env.CODEPACK_AI_API_KEY during development. It is never included in exported context, logs, settings files, Git commits, or the extension package.

How AI mode works

  1. Enable AI in settings: codepack.ai.enabled = true
  2. Set your API key: Set CODEPACK_AI_API_KEY in your environment
  3. Open the CodePack sidebar
  4. Click Analyze with AI
  5. Review the consent dialog and approve
  6. Review suggested features and check/uncheck files
  7. Preview or copy the selected feature context

What data is sent in Metadata Only mode

In Metadata Only mode (default), the following is sent:

  • Relative file paths
  • File extensions and languages
  • Import statements
  • Export statements
  • Function, class, and symbol names
  • Route definitions (e.g., GET /api/users)
  • API endpoint strings (e.g., https://api.example.com)

The following is never sent:

  • Full file contents
  • .env files
  • Lock files
  • Binary files
  • Ignored files
  • API keys
  • Secrets

Feature context output

The feature context output includes:

  • Feature summary
  • Feature source (AI suggestion, local heuristic, or manual)
  • Entry points
  • Feature structure tree (grouped by role)
  • File relationships (import graph)
  • File contents in fenced code blocks
  • Local processing notice
  • Selection review notice

Files are ordered by role priority: entry points, routes, controllers, services, repositories, models, middleware, dependencies, tests, manually added.

Configuration

All settings are optional and all processing remains fully local — changing them never triggers any network activity.

Core settings

{
  "codepack.excludePatterns": ["storage/**", "public/uploads/**", "*.log"],
  "codepack.includeExtensions": [".ts", ".tsx", ".css", ".json"],
  "codepack.maxFileSizeKB": 300,
  "codepack.showTokenEstimate": true,
  "codepack.includeHeaderNotice": true
}

AI settings

{
  "codepack.ai.enabled": false,
  "codepack.ai.baseUrl": "https://api.z.ai/api/paas/v4",
  "codepack.ai.model": "glm-4.5-flash",
  "codepack.ai.timeoutMs": 30000,
  "codepack.ai.sendMode": "metadataOnly"
}
Setting Default Description
codepack.ai.enabled false Enable optional AI-assisted feature suggestions
codepack.ai.baseUrl https://api.z.ai/api/paas/v4 OpenAI-compatible API base URL
codepack.ai.model glm-4.5-flash Model name for AI feature analysis
codepack.ai.timeoutMs 30000 Request timeout in milliseconds (minimum 5000)
codepack.ai.sendMode "metadataOnly" What data can be sent to the AI provider

codepack.excludePatterns

Additional glob patterns for files or folders to exclude, on top of the built-in defaults (.git, node_modules, dist, build, binaries).

codepack.includeExtensions

When empty (default), all supported text/code files are included. When set, only files with these extensions are included.

codepack.respectGitIgnore

When true (default), files and folders matched by .gitignore rules are excluded.

codepack.maxFileSizeKB

Maximum size of one file included in the export (default 500).

codepack.maxTotalSizeKB

Total generated context size that triggers the large-copy warning (default 5000).

codepack.warnBeforeLargeCopy

Show a confirmation before copying large context (default true).

codepack.showTokenEstimate

Show estimated token count in notifications (default true).

codepack.includeHeaderNotice

Include a local-processing notice in generated Markdown (default true).

codepack.sortOrder

Only value today: foldersFirstAlphabetical.

.gitignore Support

  • Enabled by default via codepack.respectGitIgnore.
  • Reads .gitignore files directly from the workspace file system. Git does not need to be installed.
  • Nested .gitignore files are supported.
  • Negation rules (!) work for common cases.

Large context safety

Before copying full LLM context, the extension measures the final output and compares it with your limit. If exceeded, you get a modal warning with three choices:

  • Copy Anyway — copies the output as-is
  • Preview Instead — opens the output read-only, without copying
  • Cancel — does nothing

Privacy and security

Local Context Exporter processes selected workspace files only on your machine.

  • No login
  • No account
  • No API key (unless you configure one)
  • No backend
  • No code upload
  • No telemetry
  • No network requests (when AI mode is disabled)

Generated content lives only in your clipboard or an in-memory preview document. Diagnostics logged to the output channel contain counts and paths metadata only — never file contents.

AI feature suggestion limitations

  • AI suggestions are estimates, not authoritative truth
  • AI cannot select .env, secret files, lock files, binaries, or ignored files
  • AI must never bypass .gitignore, custom exclusions, binary filtering, or max file limits
  • User must always see selected files before preview/copy
  • AI output is validated locally; invalid paths are dropped

Limitations

  • Markdown output only (XML/plain text may come later).
  • A file inside a fully ignored directory cannot be re-included by nested .gitignore negation.
  • Symlinks are skipped rather than followed.
  • Token estimates are approximations (chars / 4), not real tokenizer counts.
  • Manual features are not persisted across VS Code restarts.

Development

npm run compile   # type-check + emit to out/
npm run watch     # incremental build
npm test          # run unit tests

Project layout:

  • src/core/ scanner, tree builder, formatters, config, gitignore, context generator, types, AI modules, feature store, local analyzer, dependency resolver, relationship graph, feature context formatter
  • src/utils/ safe fence logic, path helpers
  • src/commands/ thin UI layers for copy, preview, tree-only, feature analysis, feature context, manual feature creation
  • src/views/ webview sidebar for feature selection
  • resources/ SVG icon for Activity Bar
  • test/ mocha unit tests over pure modules and stubbed vscode APIs

Testing

npm test

Packaging

npx @vscode/vsce package --allow-missing-repository

The only runtime dependency, ignore, is bundled into the VSIX.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft