AI 项目已归档

vscode-ext-ai-context-generator

已归档的 VS Code 上下文生成器,附真实压缩率复盘与当前 Agent 时代的局限分析。

vscode-ext-ai-context-generator 项目封面或真实界面
TypeScript主要技术栈
0GitHub Stars
0Forks
191索引文件
MIT License许可标记
2026-09-20最近更新

01 / PROJECT OVERVIEW

项目研究解读

已归档的 VS Code 上下文生成器,附真实压缩率复盘与当前 Agent 时代的局限分析。 本仓库以 TypeScript 为主要技术栈,当前快照索引 191 个文件。报告依据README 与目录结构整理,重点呈现项目用途、工程结构和复用方式,不把宣传描述等同于验证结论。

02 / CORE CAPABILITIES

值得关注的能力

  1. 01

    围绕“已归档的 VS Code 上下文生成器,附真实压缩率复盘与当前 Agent 时代的局限分析”提供公开实现或研究资料

  2. 02

    以 TypeScript 为主,保留 191 个可检查仓库文件

  3. 03

    提供原始 GitHub 链接、目录导览和本地研究快照,便于复核与二次开发

03 / ENGINEERING

工程与仓库结构

仓库以 TypeScript 为主要实现语言,研究快照包含 191 个文件、17 个主要顶层入口。已提供 README 作为使用与能力说明。 项目最近更新时间为 2026-09-20,许可标记为 MIT License。

01CHANGELOG.md

项目文件与实现资料

02LICENSE

项目文件与实现资料

03README.md

项目文件与实现资料

04VSCODE_MARKETPLACE.md

项目文件与实现资料

05assets

演示、模型或静态资源

06docs

设计文档、研究记录或项目配图

04 / USE CASES

适合用在哪里

  • 学习项目设计与实现
  • 评估后用于二次开发
  • 作为相关领域的研究参考

05 / QUICK START

从仓库开始

以下命令摘自项目 README 或根据仓库地址生成。请先阅读源仓库的安装要求、许可和脚本,再在自己的环境中运行。

git clone https://github.com/suifei/vscode-ext-ai-context-generator.git
cd vscode-ext-ai-context-generator

06 / REPOSITORY MAP

目录证据导览

这里列出快照中的前 191 个索引文件中的代表路径,帮助你快速定位源码、文档、测试与资源。

  • .aicontextignore
  • .eslintrc.json
  • .gitignore
  • .mocharc.yml
  • .nycrc.yml
  • .prettierrc
  • .vscode/launch.json
  • .vscode/tasks.json
  • .vscodeignore
  • CHANGELOG.md
  • LICENSE
  • README.md
  • VSCODE_MARKETPLACE.md
  • assets/logo.png
  • assets/logo.svg
  • docs/ADR-GUIDE.md
  • docs/ARCHITECTURE.md
  • docs/AST-SEMANTIC-ROADMAP.md
  • docs/PRD.md
  • docs/SEMANTIC-OUTLINE-SPEC.md
  • docs/TECH-DEBT.md
  • docs/samples/SEMANTIC-EVAL-REPORT.md
  • package-lock.json
  • package.json
  • package.nls.json
  • package.nls.zh-cn.json
  • scripts/generateSemanticEvalReport.cjs
  • scripts/php/ast_dump.php
  • scripts/runSemanticBundleOnly.cjs
  • scripts/runSemanticC4Sample.cjs
  • scripts/runSemanticCppSamples.cjs
  • scripts/runSemanticCsharpSamples.cjs
  • scripts/runSemanticJavaSamples.cjs
  • scripts/runSemanticPolyglotSamples.cjs
  • scripts/runSemanticSamples.cjs
  • src/commands/configureCommand.ts
  • src/commands/generateCommand.ts
  • src/commands/ignoreFileCommand.ts
  • src/commands/toggleLargeFileDegradationCommand.ts
  • src/config/constants.ts
  • src/core/binaryMetadataExtractor.ts
  • src/core/contextGenerator.ts
  • src/core/dirTreeGenerator.ts
  • src/core/fileReader.ts
  • src/core/fileScanner.ts
  • src/core/ignoreFilter.ts
  • src/core/logger.ts
  • src/core/smartSummarizer.ts
  • src/core/templateRenderer.ts
  • src/core/tokenCounter.ts
  • src/extension.ts
  • src/outline/astExtractor.ts
  • src/outline/astSemanticOutlineExtractor.ts
  • src/outline/bundleFingerprintUtils.ts
  • src/outline/cppCfgFlow.ts
  • src/outline/cppSemanticExtractor.ts
  • src/outline/cppTrivialAccessor.ts
  • src/outline/csharpOutlineLexerFallback.ts
  • src/outline/csharpSemanticExtractor.ts
  • src/outline/formatConstants.ts
  • src/outline/goSemanticExtractor.ts
  • src/outline/javaSemanticExtractor.ts
  • src/outline/outlineExtractor.ts
  • src/outline/phpSemanticExtractor.ts
  • src/outline/polyglotSemanticExtractor.ts
  • src/outline/pythonSemanticExtractor.ts
  • src/outline/regexFallback.ts
  • src/outline/registry.ts
  • src/outline/semanticOutlineValidation.ts
  • src/outline/subprocessSemanticPaths.ts
  • src/outline/treeSitterRuntime.ts
  • src/outline/typescriptSemanticExtractor.ts
  • src/summary/configAnalyzer.ts
  • src/summary/csvAnalyzer.ts
  • src/summary/docAnalyzer.ts
  • src/summary/excelAnalyzer.ts
  • src/summary/genericAnalyzer.ts
  • src/summary/logAnalyzer.ts
  • src/summary/pdfAnalyzer.ts
  • src/summary/pptxAnalyzer.ts
  • src/summary/wordAnalyzer.ts
  • src/utils/errorUtils.ts
  • src/utils/fileUtils.ts
  • src/utils/gitUtils.ts
  • src/utils/languageMapper.ts
  • src/utils/languagePatterns.ts
  • src/utils/textSummarizer.ts
  • src/utils/zipReader.ts
  • test/helpers/setup.js
  • test/mocks/vscode.js

07 / SOURCE NOTES

README 原文摘录

保留原始说明便于复核。中文研究结论以当前快照为依据,后续变化请以 GitHub 仓库为准。

AI Context Generator (Advanced)

## 🗃️ This project is archived and no longer maintained

The code works and the test suite passes, but no further development, bug fixes, or releases
are planned. Issues and pull requests will not be answered. Feel free to fork it.

本项目已归档,不再维护。 代码可用、测试通过,但不会再有新功能、缺陷修复或发布,
Issue 与 PR 也不会得到回复。欢迎自行 fork。

See Why this is archived for an honest assessment of what
this tool is still good for in the current LLM landscape, and what a fork should fix first.

English | 简体中文 | Why archived / 为什么归档


Why this is archived / 为什么归档

The premise it was built on has largely expired

This tool was designed for a world where chat models had no file access, context windows were 4K–32K, and pasting dozens of files by hand was painful. Three of those four premises are gone:

  • Context is rarely the binding constraint now. 200K is routine, 1M is available.
  • Coding agents read files themselves. Claude Code, Cursor, Copilot and friends have

filesystem access and grep. Packaging a repo into one document to paste is a redundant step inside those tools.

  • Targeted retrieval usually beats bulk feeding. Dumping hundreds of thousands of tokens of

mostly-irrelevant code measurably degrades answer quality — it is not just a cost question.

  • Only "tokens still cost money" survives intact.

There are also now several tools in this niche (repomix, gitingest, files-to-prompt, …), some with their own tree-sitter compression.

What measurably did not work as advertised

The README used to claim "typically 90%+ compression". Measured across the 36 files larger than 50KB in test/samples (4.58M → 1.12M tokens, 75% overall), the real picture is bimodal and unreliable:

Code shapeOutline size vs. sourceExample
Dense generated parsers9–30%Go parser 1670KB → 9%
Ordinary source45–75%llama-context.cpp → 73%
Many one-line stub methods100–157% (bigger)Java BaseListener → 150%
Data tables with no functions~0%Go lexer 181KB → 140 tokens

Two problems are visible here. Each outline entry carries loc/io/dep metadata, so files made of tiny methods come out larger than the source. And more seriously, the near-0% rows are not compression — they are near-total omission, presented to the user as a normal-looking outline with no signal that ~99% of the file was dropped. For a context tool that is the worst failure mode: the model then reasons confidently over an incomplete map.

What still has real value

Honestly narrowed, but not zero — roughly in order of defensibility:

  1. Chat workflows with no tool access — claude.ai / ChatGPT web, or a corporate-approved chat

endpoint that cannot touch your filesystem. One click to package a folder is still a genuine time saver. This is the largest remaining audience.

  1. Air-gapped / compliance environments. Processing is 100% local and secrets are redacted.
  2. Hand-curated subsets. Right-click five files and ask "is the design consistent here" —

human selection often beats agent retrieval, with lower communication cost.

  1. A reproducible artifact. The output can be diffed, committed, attached to a ticket, or fed

to several models for comparison. Agent exploration is not reproducible.

  1. The semantic outline itself — a function-level behavioural map of a large unfamiliar

codebase is something agents still do poorly. This is the piece with durable value.

What a fork should do first
  1. Lead with the repo map, not the bulk dump. The map is the differentiated capability; bulk

export is the depreciating one.

  1. Emit a machine-readable index for agents (symbol → file → line → summary), so the tool

becomes complementary to agentic IDEs instead of competing with them. This is the biggest unexploited opportunity here.

  1. Add coverage self-checks. "Extracted 0 functions from a 900KB file" must warn loudly rather

than silently emit an empty shell.

  1. Shrink the language matrix, or label reliability honestly. Each language extractor is a

small compiler, and its failures are silent — it never crashes, it just quietly reports less. Three languages done right beats seven done halfway.

  1. Lean into privacy and redaction — agent tooling largely does not do this.
Maintenance reality

A full audit before archiving found roughly 50 real defects in ~10K lines, including:

  • the packaged VSIX could not activate at all (broken since 1.5.0 — web-tree-sitter was

marked as a webpack external while node_modules was excluded from the package, so it only ever worked in the dev host)

  • the Go extractor returning 0 functions on a real 100KB file (correct answer: 634)
  • every C# method reporting -> void because the return-type field name was wrong
  • 819 of 1496 "functions" in a Dart sample being fabricated by a body-scanning bug
  • unclosed Markdown code fences swallowing the rest of every document
  • template substitution silently rewriting $TIMESTAMP / $SCOPE inside users' shell scripts

All of these are fixed in the final commit. They are listed here because they illustrate the point above: the surface area of per-language extractors is large relative to the payoff, and the failures are quiet. See CHANGELOG.md for the full list.

中文摘要

为什么归档:这个工具的设计前提(聊天模型没有文件访问能力、上下文 4K–32K、Token 极度紧张) 如今四条坏了三条。上下文不再是主要约束,编码 Agent 会自己读文件,按需检索通常比整包投喂更准。

实测结论:原 README 宣称的"通常压缩 90%+"不成立。对 test/samples 下 36 个大文件实测整体为 75%,且分布极不稳定:稠密 parser 能到 9–30%,普通源码 45–75%,而由大量单行桩方法构成的文件 比源码还大(最高 157%)。更严重的是,无函数的数据型文件产出近乎为空的大纲——那是**信息丢弃 而非压缩**,且用户拿不到任何提示。

仍然成立的价值:无工具权限的聊天场景、隔离/合规环境、人工精选子集、可复现的产物,以及 语义大纲本身——"在读代码之前先知道该读什么",恰好是长上下文和 Agent 都没解决好的部分。

若要 fork,优先做:把仓库地图提到主位而非整包导出;输出给 Agent 用的机器可读索引(这是最大 的未开发机会);补覆盖率告警;收缩语言矩阵或诚实标注可靠性;把隐私脱敏当作正式卖点。

维护现实:归档前的全面审查在约 1 万行代码里找出约 50 个真实缺陷,包括**打包出来的 VSIX 根本无法激活**(自 1.5.0 起,因为本地开发一直正常所以从未被发现)。每个语言提取器本质上是个 小编译器,而它们的错误几乎都是静默的——不崩溃,只是悄悄少给或给错。全部清单见 CHANGELOG.md,均已在最后一次提交中修复。


English

A VSCode extension that generates structured Markdown context from project files for AI assistant interactions.

Right-click any file/folder → Generate to Clipboard/File/Preview

Features
  • Smart Filtering: .aicontextignore support (auto-merges .gitignore)
  • Intelligent Processing:
  • Code files: Full content with syntax highlighting
  • Large files (>50KB): TS/JS function-level semantic summary (Compiler API), then LSP/symbol outline for other languages (Py/Go/Rust/Java/C++)
  • Logs/CSV/Config: Smart summaries
  • Office Documents: Text extraction with smart summarization (PDF/Word/Excel/PowerPoint)
  • Binary: Metadata extraction
  • Flexible Output: Clipboard, file, or preview tab
  • Token Counting: Tiktoken (accurate) or simple estimation
  • Custom Templates: .ai_context_templates/*.md with variables
  • Smart Text Summarization: TextRank algorithm for intelligent content compression
Installation
Press Ctrl+Shift+X → Search "AI Context Generator (Advanced)" → Install
Quick Start

Right-click menu:

  • Generate AI Context to Clipboard
  • Generate AI Context to File
  • Generate AI Context to Preview

Command Palette (Ctrl+Shift+P):

  • AI Context Generator: Generate AI Context
  • AI Context Generator: Open Logs
  • AI Context Generator: Generate .aicontextignore
Configuration

Create .aicontextignore in project root (same syntax as .gitignore):

node_modules/**
dist/**
*.min.js

Key Settings (aiContext.*):

SettingDefaultDescription
maxFileSize51200File size threshold for outline mode (bytes)
maxTokens128000Token warning threshold (local counting, no AI API)
enableLargeFileDegradationtrueEnable size-based large file outline/summary mode
Template Variables
VariableDescription
$PROJECT_NAMEProject/folder name
$DIR_TREEASCII directory tree with emoji
$FILE_CONTENTSFormatted file contents
$TOKEN_COUNTTotal token count
$FILE_COUNTNumber of files

Technical Highlights

🧠 Intelligent Layered Processing

The extension uses a layered processing architecture that automatically selects the optimal processing strategy based on file type and size:

File TypeProcessing MethodOutput
Any file ≤50KBFull readSource code / text + syntax highlighting
Large code files (>50KB)TS/JS: semantic compressed outline (inputs/returns/flow/calls); others: LSP/symbol outlineBehavior-oriented summary or types, signatures, call relations
Large log files (>50KB)Pattern analysisLog level distribution, error patterns, time range
Large data files (>50KB, .csv/.tsv)Structure inferenceField types, sample data, statistics
Large config files (>50KB, JSON/YAML/XML)Smart summarizationStructure skeleton, sensitive data redaction
Large document files (>50KB, .md/.txt)Content analysisSection outline, keyword extraction
PDF (.pdf)Text extraction + TextRank summaryPage structure, key sentences
Word (.docx)Text extraction + TextRank summaryParagraph structure, key points
Excel (.xlsx/.xls)Spreadsheet analysisSheet schemas, column types, sample data
PowerPoint (.pptx)Slide text extractionSlide titles, content summary
Binary filesMetadata extractionFormat info, dimensions/duration, etc.
🏗️ Large-code outline pipeline

For large code files, extraction order depends on language:

TypeScript / JavaScript

  1. TypeScript Compiler API — function-level semantic summary (inputs, returns, 3–8 flow steps, calls; optional side effects/branches in detailed)
  2. DocumentSymbol — hierarchical symbol tree if semantic step is insufficient
  3. SymbolInformation — flat symbols
  4. Regex — last resort

Other languages (Python, Go, Rust, Java, C/C++, …)

  1. DocumentSymbol → SymbolInformation → Regex

Benefits:

  • TS/JS prioritizes behavior-oriented context over raw symbol dumps when possible
  • Other languages still get concise structural outlines via LSP
  • Reduces token consumption versus full file content, but the ratio depends heavily on the code.

Measured over the 36 large files in test/samples (4.58M → 1.12M tokens, 75% overall): dense generated parsers compress to 9–30%, ordinary source lands around 45–75%, and files made of many one-line stub methods can come out larger than the source (up to 157%) because each entry carries loc/io/dep metadata. Data-heavy files with no functions (lexer tables) yield an almost empty outline — that is omission, not compression.

📊 Smart Summary Engine

For non-code files, the extension has dedicated analyzers:

  • Log Analyzer: Identifies log level distribution (INFO/WARN/ERROR), detects error patterns, extracts key time ranges
  • Config Analyzer: Parses JSON/YAML structure, auto-redacts sensitive fields (password/token/secret)
  • Doc Analyzer: Extracts Markdown heading hierarchy, keywords, and paragraph summaries
  • CSV Analyzer: Infers field types, detects numeric ranges, provides data samples
  • PDF Analyzer: Extracts text with page structure, uses TextRank for intelligent summarization
  • Word Analyzer: Extracts .docx text with paragraph detection, generates smart summaries
  • Excel Analyzer: Analyzes workbook structure, multiple sheets with schema inference
  • PowerPoint Analyzer: Extracts slide titles and content, provides presentation summary

TextRank Algorithm:

  • Jaccard similarity for sentence ranking (supports UTF-8/Unicode)
  • Extracts key sentences based on