⚡ RepoContext
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
**The Next-Generation AST Codebase Map, Token Compression, and Context Packaging Engine for AI Coding Agents and IDEs.**
English | 中文说明
---
🌟 Why RepoContext?
When feeding codebases into modern AI coding assistants (**Claude Code**, **Cursor**, **Windsurf**, **OpenAI Codex**, **Antigravity**, **Cline**), developers face three critical bottlenecks:
1. 💥 **Token Explosion & High API Costs**: Raw code dumps quickly exceed context limits or cost tens of dollars per query.
2. 📉 **Low Signal-to-Noise Ratio**: 80% of lines are routine implementation details. LLMs only need the semantic API surface (signatures, types, interfaces, docstrings).
3. 🔓 **Security Leaks**: Accidental exposure of .env credentials, API keys, and database URIs in prompts.
**RepoContext** solves all three with intelligent AST outline pruning, task-focused semantic file ranking, automated credential redaction, and native **Model Context Protocol (MCP)** integration.
---
🚀 Key Features
* ⚡ **AST Codebase Map & Skeletonizer**: Compresses source files by **70%~85%** while retaining 100% of interfaces, types, functions, and JSDoc/docstrings.
* 🎯 **Task-Oriented Relevance Pruning**: Pass your prompt query (e.g. repocontext pack -q "Fix JWT auth token expiry") to automatically rank and pack only the most critical files.
* 🛡️ **Automated Secret Scanner & Redaction**: Built-in entropy and regex scanner detects and masks OpenAI keys, GitHub tokens, AWS keys, JWTs, and database URIs.
* 🔌 **Native Model Context Protocol (MCP) Server**: Directly integrates with Claude Desktop, Cursor, Windsurf, and Antigravity via standard MCP tools.
* 📑 **Multi-Format Export**: Generates clean Markdown with directory trees, Claude-optimized XML ( ), or structured JSON.
* 📊 **Multi-Model Token & Cost Analytics**: Real-time token counter with cost estimates for GPT-4o, GPT-5, Claude 3.5 Sonnet, and Gemini 1.5 Pro.
---
📦 Quick Start
1. Run without installation via npx
2. Global Installation
---
🛠️ CLI Usage & Options
Options for pack:
| Option | Description | Default |
| :--- | :--- | :--- |
| -m, --mode | Packing mode: full, ast, relevant, hybrid | "full" |
| -q, --query | Filter and rank files relevant to coding prompt | None |
| -f, --format | Output format: markdown, xml, json | "markdown" |
| -o, --output | Output file path | "repocontext-output.md" |
| -t, --max-tokens | Maximum token budget | 80000 |
| -c, --copy | Copy output directly to system clipboard | false |
| --no-security | Disable automated secret redaction | false |
---
🔌 Model Context Protocol (MCP) Integration
RepoContext comes with built-in MCP server support. Add it to your claude_desktop_config.json or Cursor/Windsurf MCP settings:
Exposed MCP Tools (4-Tier Context Pyramid):
* get_codebase_map: Extracts token-efficient AST symbol outline map across the repository (~80% token savings).