Integrations
Allows users to join the project's Discord channel for updates, support, and community discussions about the code2prompt tool.
Integrates with Git to include diffs, logs, and branch comparisons in generated prompts, and respects .gitignore rules when processing codebases.
Enables accessing repositories for code processing and interacting with GitHub-hosted codebases to generate structured prompts.
快速安装⚡
带有 pip 的 SDK 🐍
它有何用处?
核
code2prompt
是一款代码提取工具,可简化创建 LLM 提示的过程,用于代码分析、生成和其他任务。它的工作原理是遍历目录、构建树形结构并收集每个文件的相关信息。其核心库可以轻松集成到其他应用程序中。
命令行界面
code2prompt
命令行界面 (CLI) 专为用户设计,可直接从代码库生成提示。生成的提示会自动复制到剪贴板,也可以保存到输出文件中。此外,您还可以使用 Handlebars 模板自定义提示生成。请查看文档中提供的提示!
SDK
code2prompt
软件开发工具包 (SDK) 提供 Python 绑定到核心库的功能。这对于希望与代码库无缝交互的 AI 代理或自动化脚本来说非常理想。该 SDK 托管在 Pypi 上,可通过 pip 安装。
微胶囊钙
code2prompt
也可用作模型上下文协议 (MCP) 服务器,允许您将其作为本地服务运行。这为 LLM 提供了一种工具,可以自动收集代码库结构良好的上下文,从而增强其功能。
文档📚
请查看我们的在线文档以获取详细说明
特征
Code2Prompt 可将您的整个代码库转换为适用于大型语言模型的结构良好的提示。主要功能包括:
- 自动代码处理:将任意大小的代码库转换为可读的格式化提示
- 智能过滤:使用 glob 模式包含/排除文件并遵守
.gitignore
规则 - 灵活的模板:使用 Handlebars 模板针对不同用例自定义提示
- 令牌跟踪:跟踪令牌使用情况以保持在 LLM 上下文限制内
- Git 集成:在提示中包含差异、日志和分支比较
- 开发人员体验:自动剪贴板复制、行号和文件组织选项
告别手动复制文件和格式化 LLM 代码的烦恼。Code2Prompt 帮您处理这些繁琐的工作,让您专注于从 AI 模型中获取洞察和解决方案。
替代安装
请参阅文档以获取详细的安装说明。
二进制版本
从Releases下载适合您的操作系统的最新二进制文件。
源代码构建
要求:
星史
执照
根据 MIT 许可证授权,请参阅 LICENSE 了解更多信息。
喜欢这个项目吗?
如果您喜欢该项目并发现它有用,请给它一个:star:!
贡献
贡献方式:
- 建议一项功能
- 报告错误
- 修复某些问题并打开拉取请求
- 帮我记录代码
- 传播信息
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
一款代码提取工具,可将您的代码即时转换为 AI 优化的提示。使用 code2prompt 收集相关上下文。了解更多信息,请访问 code2prompt.dev
Related Resources
Related MCP Servers
- -securityAlicense-qualityProvides pre-defined prompt templates for AI assistants to generate comprehensive plans for TypeScript projects, API architectures, and GitHub workflows.Last updated -0TypeScriptMIT License
- -securityAlicense-qualityAn MCP server that analyzes codebases and generates contextual prompts, making it easier for AI assistants to understand and work with code repositories.Last updated -2PythonMIT License
- -securityAlicense-qualityServes prompt templates through a standardized protocol for transforming basic user queries into optimized prompts for AI systems.Last updated -PythonApache 2.0
- -securityAlicense-qualityAllows AI assistants to access prompts from promptz.dev API without copy-pasting, reducing context switching in your development workflow.Last updated -5TypeScriptMIT No Attribution