-
Notifications
You must be signed in to change notification settings - Fork 0
Developer Guide
This page summarizes the codebase for contributors and AI coding agents working on Export2AI.
For strict agent rules, read Agent Chokepoints and AGENTS.md before structural changes.
Export2AI is a TypeScript VS Code/Cursor extension that creates AI-ready source archives with safe excludes, Git metadata soft-delete, project tree copy, single-file copy, and offline token estimates.
Runtime entry:
src/extension.ts
Compiled output:
out/
Packaged VSIX output:
build/export2ai-x.y.z.vsix
| Path | Purpose |
|---|---|
src/extension.ts |
activation, command registration, zip workflow, notifications |
src/projectService.ts |
ignore context, copy project structure, copy one file |
src/zipService.ts |
archive creation, manifest, token count after collection |
src/tokenEstimate.ts |
status bar, optional Explorer badges, cached folder aggregation |
src/config.ts |
settings read, defaults, clamps, built-in excludes |
src/types.ts |
shared configuration and file collection types |
src/utils/ |
tokenization, file processing, soft-delete, tree generation, formatting, debug logging |
scripts/ |
manifest merge, menu generation, packaging, tests, release helpers |
docs/ |
technical documentation |
wiki/ |
source files for public GitHub Wiki pages |
tests/ |
critical smoke target runner |
extension.ts
→ zipFolder()
→ zipService.createZipArchive()
→ projectService.prepareIgnoreContext()
→ FileProcessor.collectFiles()
→ TokenCounter.countFilesContent()
→ archiver writes .zip
→ optional _EXPORT2AI_MANIFEST.txt
→ notification + clipboard/system reveal actions
Key behaviors:
- selected folder or first workspace folder is the source
- output zip is written to the workspace root
- built-in excludes and
.gitignoremerge into an ignore instance -
excludePathsis a separate hard path filter - symlinks are skipped
- binary/large/invalid UTF-8 files become placeholders
- unreadable repository-control paths get visible read-error placeholders
TokenEstimateManager
→ collectFilesUnder()
→ FileProcessor.collectFiles()
→ TokenCounter.countFilesContent() or countFilesPerPath()
→ tokenFormat helpers
→ status bar / notification / optional Explorer badges
Important constraints:
- first full scan is deferred after activation
- settings navigation temporarily delays scans
- config changes clear cache and pending estimates
- optional Explorer badges aggregate once; they do not scan per folder
- stale in-flight estimates are dropped when config/model changes
config.ts
→ DEFAULT_EXCLUDE_PATTERNS
→ merge built-ins + disabled built-ins + user excludes + legacy excludes
projectService.ts
→ create ignore instance
→ optionally merge .gitignore
fileProcessor.ts
→ skip credentials/symlinks/excluded paths
→ preserve repository-control files when soft-delete allows
→ add Git placeholder for .git internals
Relevant utilities:
| File | Responsibility |
|---|---|
src/utils/ignoreUtils.ts |
ignore instance, dot/dollar rules, .gitignore, path exclusions |
src/utils/gitMetadataSoftDelete.ts |
repo-control detection, credential guard, placeholders |
src/utils/fileProcessor.ts |
traversal and content processing |
src/utils/projectTree.ts |
structure-only tree generation |
export2ai.llmModel is the single source of truth for:
- zip filename
- status bar label
- target-model menu row
- progress and notification copy
- token estimate method
- manifest metadata
Generated menu rows are intentionally small. Do not reintroduce token-count bucket commands.
Relevant files:
| File | Purpose |
|---|---|
src/utils/modelRegistry.ts |
model family and default model |
src/utils/menuTargetModels.ts |
known target menu models |
src/utils/modelFormat.ts |
filename/model display formatting |
src/utils/tokenFormat.ts |
status bar, tooltip, token badge formatting |
scripts/generate-model-target-menu.js |
generated target-model submenu commands |
scripts/merge-package.js |
merge slim manifest + generated commands |
- Add the property to
package.slim.jsonunder the right contributed settings group. - Extend
Export2AIConfigurationinsrc/types.ts. - Read and clamp it in
src/config.ts. - Wire it through the relevant service.
- Update docs and wiki pages.
- Add or update tests.
- Run:
npm run compile
npm run test:critical| File | Role |
|---|---|
README.md |
compact landing page, under ~160 lines |
wiki/*.md |
human-readable deep guides and SEO-friendly docs |
docs/*.md |
technical maintainer reference |
AGENTS.md |
AI agent operating rules |
CHANGELOG.md |
release notes |
README should link to wiki pages instead of growing into a long manual.
Run at least:
npm run compile
npm run test:criticalFor focused changes, add relevant target tests:
npm run test:tokens
npm run test:soft-delete
npm run test:settings-nav
npm run test:explorer-badges
npm run test:menu-mergeExport2AI · AI-ready zip archives for VS Code, Cursor, ChatGPT, Claude, and LLM coding agents.
Repository · README · Releases · Open VSX · GPL-3.0-only
Export2AI Wiki
Start
Safety & AI Context
- 🛡️ Safe Exports & Excludes
- 🌿 Git Metadata Soft-Delete
- 🧮 Token Estimates & AI Model Support
- 🧹 Comment Stripping & Compression
Configuration & Support
Contributors