开源代码生成 是 AI Skill Hub 本期精选AI工具之一。综合评分 8.0 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。
开源代码生成 是一款基于 TypeScript 开发的开源工具,专注于 AI、代码生成、TypeScript 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
开源代码生成 是一款基于 TypeScript 开发的开源工具,专注于 AI、代码生成、TypeScript 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:npm 全局安装 npm install -g opencoderag # 方式二:npx 直接运行(无需安装) npx opencoderag --help # 方式三:项目依赖安装 npm install opencoderag # 方式四:从源码运行 git clone https://github.com/MrDoe/OpenCodeRAG cd OpenCodeRAG npm install npm start
# 命令行使用
opencoderag --help
# 基本用法
opencoderag [options] <input>
# Node.js 代码中使用
const opencoderag = require('opencoderag');
const result = await opencoderag.run(options);
console.log(result);
# opencoderag 配置说明 # 查看配置选项 opencoderag --config-example > config.yml # 常见配置项 # output_dir: ./output # log_level: info # workers: 4 # 环境变量(覆盖配置文件) export OPENCODERAG_CONFIG="/path/to/config.yml"
# OpenCodeRAG
OpenCodeRAG is a local-first RAG plugin for semantic code and image search. It converts your codebase into vector indices and retrieves relevant code chunks on natural language queries. The primary aim is to save tokens by replacing full-file reads with targeted chunk retrieval and to speed-up tool calls for large codebases. Integrates seamlessly with OpenCode and works as a standalone MCP server or CLI tool for other AI harnesses.
You don't need a dedicated GPU to run smaller embedding LLMs, as these models can still run performant on modern CPUs.
⚠️ Note: Don't confuse this with the npm package opencode-rag (a discontinued project by a different author).
| Feature | Description |
|---|---|
| **MCP server** | opencode-rag mcp - stdio-based MCP server exposing search_semantic, get_file_skeleton, find_usages, and describe_image tools for any MCP-compatible client |
| **AST chunking** | 26 languages via tree-sitter (TS, JS, Python, Java, Go, Rust, C/C++, C#, Ruby, Kotlin, Swift, Bash, PHP, PowerShell, SQL, JSON, HTML, CSS, XML (including SVG), YAML, TOML, INI, Dockerfile, Markdown, LaTeX, Razor) |
| **Document support** | Markdown, LaTeX, PDF, DOCX, DOC, Excel |
| **Image indexing** | Describe images via vision LLM and store descriptions as searchable vector chunks |
| **Hybrid search** | Vector similarity + TF×IDF keyword fusion |
| **OpenCode plugin** | Auto-inject context, read-tool override, TUI settings, Ctrl+Enter to add RAG context, MCP registration on init |
| **Incremental indexing** | File-hash manifest, background watcher, auto-rebuild on corruption |
| **Privacy-first** | All processing stays local (when using Ollama) |
| **CLI Tools** | init, index, query, status, list, show, dump, clear, describe-image, ui, mcp, setup, quirk, eval:sessions, eval:analyze, eval:compare |
| **Proxy-aware** | Corporate proxy support with raw-socket localhost bypass |
| **OpenAI / Anthropic / Cohere** | Use alternate embedding providers with API key auto-resolution |
| **Evaluation** | Session-level token tracking, RAG-on vs RAG-off comparison, tiktoken BPE counting |
| **Documentation mode** | /doc slash command: agent adds JSDoc/TSDoc to undocumented files, progress tracked per subdirectory |
| **Wiki mode** | /wiki slash command: agent maintains a persistent knowledge wiki at .opencode/wiki/ (ingest, query, lint, seed) |
| **Context optimization** | Post-retrieval dedup, per-file chunk limits, adjacent-merge to fit the context window |
| **Quirk memory** | Persistent experiential memory — agents recall/persist gotchas, preferences, decisions across sessions (add_quirk / recall_quirks, opencode-rag quirk) |
| **AGENTS.md directive** | opencode-rag init merges a tool-usage directive into AGENTS.md via sentinel markers |
npm install -g opencode-rag-plugin
```bash
OpenCodeRAG ships a CLI-based MCP (Model Context Protocol) server that exposes semantic code tools to any MCP-compatible client (Claude Desktop, Cursor, etc.).
opencode-rag mcp
Note: The MCP server is optional. When running as an OpenCode plugin, the four tools are registered in-process and work without the MCP server. Thechat.messagehook for hotkey injection also runs in-process. The MCP server is only needed when an external MCP client connects to OpenCodeRAG. The plugin auto-starts the server only ifmcp.enabledistruein your config (default:false).
opencode-rag query "authentication middleware" ```
Prerequisites: Node.js v22+, Ollama (default) or other LLM-hosters (OpenAI-, Google- or Anthropic-compatible).
Contributors / developers: Clone the repo and use npm install --legacy-peer-deps; npm run build — see Development docs.
When using OpenCode, the plugin enhances your agent with three discovery mechanisms:
高质量的开源AI工具,代码生成能力强
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
经综合评估,开源代码生成 在AI工具赛道中表现稳健,质量优秀。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | OpenCodeRAG |
| 原始描述 | 开源AI工具:OpenCodeRAG is a RAG (Retrieval-Augmented Generation) plugin for semantic code s。⭐14 · TypeScript |
| Topics | AI代码生成TypeScript |
| GitHub | https://github.com/MrDoe/OpenCodeRAG |
| License | MIT |
| 语言 | TypeScript |
收录时间:2026-06-14 · 更新时间:2026-06-16 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。