[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-raphaelmansuy--code2prompt":3,"tool-raphaelmansuy--code2prompt":64},[4,17,27,35,43,56],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",138956,2,"2026-04-05T11:33:21",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":23,"last_commit_at":41,"category_tags":42,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":44,"name":45,"github_repo":46,"description_zh":47,"stars":48,"difficulty_score":23,"last_commit_at":49,"category_tags":50,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,51,52,53,15,54,26,13,55],"数据工具","视频","插件","其他","音频",{"id":57,"name":58,"github_repo":59,"description_zh":60,"stars":61,"difficulty_score":10,"last_commit_at":62,"category_tags":63,"status":16},3128,"ragflow","infiniflow\u002Fragflow","RAGFlow 是一款领先的开源检索增强生成（RAG）引擎，旨在为大语言模型构建更精准、可靠的上下文层。它巧妙地将前沿的 RAG 技术与智能体（Agent）能力相结合，不仅支持从各类文档中高效提取知识，还能让模型基于这些知识进行逻辑推理和任务执行。\n\n在大模型应用中，幻觉问题和知识滞后是常见痛点。RAGFlow 通过深度解析复杂文档结构（如表格、图表及混合排版），显著提升了信息检索的准确度，从而有效减少模型“胡编乱造”的现象，确保回答既有据可依又具备时效性。其内置的智能体机制更进一步，使系统不仅能回答问题，还能自主规划步骤解决复杂问题。\n\n这款工具特别适合开发者、企业技术团队以及 AI 研究人员使用。无论是希望快速搭建私有知识库问答系统，还是致力于探索大模型在垂直领域落地的创新者，都能从中受益。RAGFlow 提供了可视化的工作流编排界面和灵活的 API 接口，既降低了非算法背景用户的上手门槛，也满足了专业开发者对系统深度定制的需求。作为基于 Apache 2.0 协议开源的项目，它正成为连接通用大模型与行业专有知识之间的重要桥梁。",77062,"2026-04-04T04:44:48",[15,14,13,26,54],{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":76,"owner_avatar_url":77,"owner_bio":78,"owner_company":79,"owner_location":80,"owner_email":81,"owner_twitter":75,"owner_website":82,"owner_url":83,"languages":84,"stars":97,"forks":98,"last_commit_at":99,"license":100,"difficulty_score":101,"env_os":102,"env_gpu":103,"env_ram":103,"env_deps":104,"category_tags":112,"github_topics":113,"view_count":23,"oss_zip_url":81,"oss_zip_packed_at":81,"status":16,"created_at":118,"updated_at":119,"faqs":120,"releases":136},2047,"raphaelmansuy\u002Fcode2prompt","code2prompt","Code2Prompt is a powerful command-line tool that simplifies the process of providing context to Large Language Models (LLMs) by generating a comprehensive Markdown file containing the content of your codebase. ⭐ If you find Code2Prompt useful, consider giving us a star on GitHub! It helps us reach more developers and improve the tool. ⭐ ","code2prompt 是一款强大的命令行工具，专为帮助开发者高效地将整个代码库转化为大语言模型（LLM）可理解的上下文而设计。在使用 AI 辅助编程时，如何让模型准确理解复杂的项目结构和文件关系往往是个难题。code2prompt 通过自动遍历项目目录，生成一份包含完整源代码、层级分明的文件树以及智能过滤信息的 Markdown 文档，完美解决了向 AI 提供全面背景信息的痛点。\n\n这款工具特别适合软件工程师、技术团队以及需要利用 AI 进行代码审查、文档生成或重构的开发者使用。它不仅能自动遵循 `.gitignore` 规则排除无关文件，还支持通过 Glob 模式灵活筛选特定文件，确保输入内容的精准度。其独特的技术亮点包括：内置 Jinja2 模板系统，允许用户自定义提示词格式以适应不同任务；智能 Token 计数功能，防止超出模型限制；以及支持自定义语法高亮和行号显示，极大提升了代码片段的可读性与引用便利性。此外，生成的内容可直接复制到剪贴板或保存为文件，无缝融入日常开发工作流，让 AI 真正成为懂你项目的编程伙伴。","# Code2Prompt\n\n[![PyPI version](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Fcode2prompt.svg)](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Fcode2prompt)\n\n[![GitHub Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fraphaelmansuy\u002Fcode2prompt.svg)](https:\u002F\u002Fgithub.com\u002Fraphaelmansuy\u002Fcode2prompt\u002Fstargazers)\n[![GitHub Forks](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fforks\u002Fraphaelmansuy\u002Fcode2prompt.svg)](https:\u002F\u002Fgithub.com\u002Fraphaelmansuy\u002Fcode2prompt\u002Fnetwork\u002Fmembers)\n[![PyPI downloads](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fdm\u002Fqllm.svg)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fcode2prompt\u002F)\n[![PyPI version](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fqllm.svg)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fcode2prompt\u002F)\n[![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow.svg)](https:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT)\n\nCode2Prompt is a powerful command-line tool that generates comprehensive prompts from codebases, designed to streamline interactions between developers and Large Language Models (LLMs) for code analysis, documentation, and improvement tasks.\n\n## Table of Contents\n\n1. [Why Code2Prompt?](#why-code2prompt)\n2. [Features](#features)\n3. [Installation](#installation)\n4. [Getting Started](#getting-started)\n5. [Quick Start](#quick-start)\n6. [Usage](#usage)\n7. [Options](#options)\n8. [Examples](#examples)\n9. [Templating System](#templating-system)\n10. [Integration with LLM CLI](#integration-with-llm-cli)\n11. [GitHub Actions Integration](#github-actions-integration)\n12. [Configuration File](#configuration-file)\n13. [Troubleshooting](#troubleshooting)\n14. [Contributing](#contributing)\n15. [License](#license)\n\n# Code2Prompt: Transform Your Codebase into AI-Ready Prompts\n\n[![PyPI version](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Fcode2prompt.svg)](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Fcode2prompt)\n[![GitHub Stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fraphaelmansuy\u002Fcode2prompt.svg)](https:\u002F\u002Fgithub.com\u002Fraphaelmansuy\u002Fcode2prompt\u002Fstargazers)\n[![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow.svg)](https:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT)\n\n![](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fraphaelmansuy_code2prompt_readme_80f28bda8a9b.png)\n\n## Supercharge Your AI-Assisted Development\n\nCode2Prompt is a powerful, open-source command-line tool that bridges the gap between your codebase and Large Language Models (LLMs). By converting your entire project into a comprehensive, AI-friendly prompt, Code2Prompt enables you to leverage the full potential of AI for code analysis, documentation, and improvement tasks.\n\n### 🚀 Key Features\n\n- **Holistic Codebase Representation**: Generate a well-structured Markdown prompt that captures your entire project's essence, making it easier for LLMs to understand the context.\n- **Intelligent Source Tree Generation**: Create a clear, hierarchical view of your codebase structure, allowing for better navigation and understanding of the project.\n- **Customizable Prompt Templates**: Tailor your output using Jinja2 templates to suit specific AI tasks, enhancing the relevance of generated prompts.\n- **Smart Token Management**: Count and optimize tokens to ensure compatibility with various LLM token limits, preventing errors during processing.\n- **Gitignore Integration**: Respect your project's .gitignore rules for accurate representation, ensuring that irrelevant files are excluded from processing.\n- **Flexible File Handling**: Filter and exclude files using powerful glob patterns, giving you control over which files are included in the prompt generation.\n- **Custom Syntax Highlighting**: Pair custom file extensions with specific syntax highlighting using the `--syntax-map` option. For example, you can specify that `.inc` files should be treated as `bash` scripts.\n- **Clipboard Ready**: Instantly copy generated prompts to your clipboard for quick AI interactions, streamlining your workflow.\n- **Multiple Output Options**: Save to file or display in the console, providing flexibility in how you want to use the generated prompts.\n- **Enhanced Code Readability**: Add line numbers to source code blocks for precise referencing, making it easier to discuss specific parts of the code.\n- **Include file**: Support of template import, allowing for modular template design.\n- **Input variables**: Support of Input Variables in templates, enabling dynamic prompt generation based on user input.\n\n### 💡 Why Code2Prompt?\n\n- **Contextual Understanding**: Provide LLMs with a comprehensive view of your project for more accurate suggestions and analysis.\n- **Consistency Boost**: Maintain coding style and conventions across your entire project, improving code quality.\n- **Efficient Refactoring**: Enable better interdependency analysis and smarter refactoring recommendations, saving time and effort.\n- **Improved Documentation**: Generate contextually relevant documentation that truly reflects your codebase, enhancing maintainability.\n- **Pattern Recognition**: Help LLMs learn and apply your project-specific patterns and idioms, improving the quality of AI interactions.\n\nTransform the way you interact with AI for software development. With Code2Prompt, harness the full power of your codebase in every AI conversation.\n\nReady to elevate your AI-assisted development? Let's dive in! 🏊‍♂️\n\n## Installation\n\nChoose one of the following methods to install Code2Prompt:\n\n### Using pip \n\n```bash\npip install code2prompt\n```\n### Using [pipx](https:\u002F\u002Fgithub.com\u002Fpypa\u002Fpipx) (recommended)\n\n```bash\npipx install code2prompt\n```\n\n## Getting Started\n\nTo get started with Code2Prompt, follow these steps:\n\n1. **Install Code2Prompt**: Use one of the installation methods mentioned above.\n2. **Prepare Your Codebase**: Ensure your project is organized and that you have a `.gitignore` file if necessary.\n3. **Run Code2Prompt**: Use the command line to generate prompts from your codebase.\n\nFor example, to generate a prompt from a single Python file, run:\n\n```bash\ncode2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fscript.py\n```\n\n## Quick Start\n\n1. Generate a prompt from a single Python file:\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fscript.py\n   ```\n\n2. Process an entire project directory and save the output:\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fproject --output project_summary.md\n   ```\n\n3. Generate a prompt for multiple files, excluding tests:\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fsrc --path \u002Fpath\u002Fto\u002Flib --exclude \"*\u002Ftests\u002F*\" --output codebase_summary.md\n   ```\n\n## Usage\n\nThe basic syntax for Code2Prompt is:\n\n```bash\ncode2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fcode [OPTIONS]\n```\n\nFor multiple paths:\n\n```bash\ncode2prompt --path \u002Fpath\u002Fto\u002Fdir1 --path \u002Fpath\u002Fto\u002Ffile2.py [OPTIONS]\n```\n\n### Custom Syntax Highlighting\n\nTo pair custom file extensions with specific syntax highlighting, use the `--syntax-map` option. This allows you to specify mappings in the format `extension:syntax`. For example:\n\n```\ncode2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fcode --syntax-map \"inc:bash,customext:python,ext2:javascript\"\n```\n\nThis command will treat `.inc` files as `bash` scripts, `.customext` files as `python`, and `.ext2` files as `javascript`.\n\nYou can also use multiple `--syntax-map` arguments or separate mappings with commas:\n\n```\ncode2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fscript.py --syntax-map \"inc:bash\"\n```\n\n```\ncode2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fproject --syntax-map \"inc:bash,txt:markdown\" --output project_summary.md\n```\n\n```\ncode2prompt --path \u002Fpath\u002Fto\u002Fsrc --path \u002Fpath\u002Fto\u002Flib --syntax-map \"inc:bash,customext:python\" --output codebase_summary.md\n```\n\n## Options\n\n| Option | Short | Description |\n|--------|-------|-------------|\n| `--path` | `-p` | Path(s) to the directory or file to process (required, multiple allowed) |\n| `--output` | `-o` | Name of the output Markdown file |\n| `--gitignore` | `-g` | Path to the .gitignore file |\n| `--filter` | `-f` | Comma-separated filter patterns to include files (e.g., \"*.py,*.js\") |\n| `--exclude` | `-e` | Comma-separated patterns to exclude files (e.g., \"*.txt,*.md\") |\n| `--case-sensitive` | | Perform case-sensitive pattern matching |\n| `--suppress-comments` | `-s` | Strip comments from the code files |\n| `--line-number` | `-ln` | Add line numbers to source code blocks |\n| `--no-codeblock` | | Disable wrapping code inside markdown code blocks |\n| `--template` | `-t` | Path to a Jinja2 template file for custom prompt generation |\n| `--tokens` | | Display the token count of the generated prompt |\n| `--encoding` | | Specify the tokenizer encoding to use (default: \"cl100k_base\") |\n| `--create-templates` | | Create a templates directory with example templates |\n| `--version` | `-v` | Show the version and exit |\n| `--log-level` | | Set the logging level (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL) |\n| `--interactive` | `-i` | Activate interactive mode for file selection |\n| `--syntax-map` | | Pair custom file extensions with specific syntax highlighting (e.g., \"inc:bash,customext:python,ext2:javascript\") |\n\n## Command Parameters\n\n### `--filter` or `-f` and `--exclude` or `-e`\n\nThe `--filter` and `--exclude` options allow you to specify patterns for files or directories that should be included in or excluded from processing, respectively.\n\n#### Syntax:\n```\n--filter \"PATTERN1,PATTERN2,...\"\n--exclude \"PATTERN1,PATTERN2,...\"\n```\nor\n```\n-f \"PATTERN1,PATTERN2,...\"\n-e \"PATTERN1,PATTERN2,...\"\n```\n\n#### Description:\n- Both options accept a comma-separated list of patterns.\n- Patterns can include wildcards (`*`) and directory indicators (`**`).\n- Case-sensitive by default (use `--case-sensitive` flag to change this behavior).\n- `--exclude` patterns take precedence over `--filter` patterns.\n\n#### Examples:\n\n1. Include only Python files:\n   ```\n   --filter \"**.py\"\n   ```\n\n2. Exclude all Markdown files:\n   ```\n   --exclude \"**.md\"\n   ```\n\n3. Include specific file types in the src directory:\n   ```\n   --filter \"src\u002F**.{js,ts}\"\n   ```\n\n4. Exclude multiple file types and a specific directory:\n   ```\n   --exclude \"**.log,**.tmp,**\u002Fnode_modules\u002F**\"\n   ```\n\n5. Include all files except those in 'test' directories:\n   ```\n   --filter \"**\" --exclude \"**\u002Ftest\u002F**\"\n   ```\n\n6. Complex filtering (include JavaScript files, exclude minified and test files):\n   ```\n   --filter \"**.js\" --exclude \"**.min.js,**test**.js\"\n   ```\n\n7. Include specific files across all directories:\n   ```\n   --filter \"**\u002Fconfig.json,**\u002FREADME.md\"\n   ```\n\n8. Exclude temporary files and directories:\n   ```\n   --exclude \"**\u002F.cache\u002F**,**\u002Ftmp\u002F**,**.tmp\"\n   ```\n\n9. Include source files but exclude build output:\n   ```\n   --filter \"src\u002F**\u002F*.{js,ts}\" --exclude \"**\u002Fdist\u002F**,**\u002Fbuild\u002F**\"\n   ```\n\n10. Exclude version control and IDE-specific files:\n    ```\n    --exclude \"**\u002F.git\u002F**,**\u002F.vscode\u002F**,**\u002F.idea\u002F**\"\n    ```\n\n#### Important Notes:\n\n- Always use double quotes around patterns to prevent shell interpretation of special characters.\n- Patterns are matched against the full path of each file, relative to the project root.\n- The `**` wildcard matches any number of directories.\n- Single `*` matches any characters within a single directory or filename.\n- Use commas to separate multiple patterns within the same option.\n- Combine `--filter` and `--exclude` for fine-grained control over which files are processed.\n\n#### Best Practices:\n\n1. Start with broader patterns and refine as needed.\n2. Test your patterns on a small subset of your project first.\n3. Use the `--case-sensitive` flag if you need to distinguish between similarly named files with different cases.\n4. When working with complex projects, consider using a configuration file to manage your filter and exclude patterns.\n\nBy using the `--filter` and `--exclude` options effectively and safely (with proper quoting), you can precisely control which files are processed in your project, ensuring both accuracy and security in your command execution.\n\n## Examples\n\n1. Generate documentation for a Python library:\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Flibrary --output library_docs.md --suppress-comments --line-number --filter \"*.py\"\n   ```\n\n2. Prepare a codebase summary for a code review, focusing on JavaScript and TypeScript files:\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fproject --filter \"*.js,*.ts\" --exclude \"node_modules\u002F*,dist\u002F*\" --template code_review.j2 --output code_review.md\n   ```\n\n3. Create input for an AI model to suggest improvements, focusing on a specific directory:\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fsrc\u002Fcomponents --suppress-comments --tokens --encoding cl100k_base --output ai_input.md\n   ```\n\n4. Analyze comment density across a multi-language project:\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fproject --template comment_density.j2 --output comment_analysis.md --filter \"*.py,*.js,*.java\"\n   ```\n\n5. Generate a prompt for a specific set of files, adding line numbers:\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fimportant_file1.py --path \u002Fpath\u002Fto\u002Fimportant_file2.js --line-number --output critical_files.md\n   ```\n\n## Templating System\n\nCode2Prompt supports custom output formatting using Jinja2 templates. To use a custom template:\n\n```bash\ncode2prompt --path \u002Fpath\u002Fto\u002Fcode --template \u002Fpath\u002Fto\u002Fyour\u002Ftemplate.j2\n```\n\n### Creating Template Examples\n\nUse the `--create-templates` command to generate example templates:\n\n```bash\ncode2prompt --create-templates\n```\n\nThis creates a `templates` directory with sample Jinja2 templates, including:\n\n- [default.j2](.\u002Fcode2prompt\u002F\u002Ftemplates\u002Fdefault.j2): A general-purpose template\n- [analyze-code.j2](.\u002Fcode2prompt\u002Ftemplates\u002Fanalyze-code.j2): For detailed code analysis\n- [code-review.j2](.\u002Fcode2prompt\u002Ftemplates\u002Fcode-review.j2): For thorough code reviews\n- [create-readme.j2](.\u002Fcode2prompt\u002Ftemplates\u002Fcreate-readme.j2): To assist in generating README files\n- [improve-this-prompt.j2](.\u002Fcode2prompt\u002Ftemplates\u002Fimprove-this-prompt.j2): For refining AI prompts\n\nFor full template documentation, see [Documentation Templating](.\u002FTEMPLATE.md).\n\n## Integration with LLM CLI\n\nCode2Prompt can be integrated with Simon Willison's [llm](https:\u002F\u002Fgithub.com\u002Fsimonw\u002Fllm) CLI tool for enhanced code analysis or [qllm](https:\u002F\u002Fgithub.com\u002Fquantalogic\u002Fqllm), or for the Rust lovers [hiramu-cli](https:\u002F\u002Fgithub.com\u002Fraphaelmansuy\u002Fhiramu-cli). \n\n### Installation\n\n```bash\npip install code2prompt llm\n```\n\n### Basic Usage\n\n1. Generate a code summary and analyze it with an LLM:\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fproject | llm \"Analyze this codebase and provide insights on its structure and potential improvements\"\n   ```\n\n2. Process a specific file and get refactoring suggestions:\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fscript.py | llm \"Suggest refactoring improvements for this code\"\n   ```\n\nFor more advanced use cases, refer to the [Integration with LLM CLI](#integration-with-llm-cli) section in the full documentation.\n\n## GitHub Actions Integration\n\nYou can integrate Code2Prompt into your GitHub Actions workflow. Here's an example:\n\n```yaml\nname: Code Analysis\non: [push]\njobs:\n  analyze-code:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions\u002Fcheckout@v2\n    - name: Set up Python\n      uses: actions\u002Fsetup-python@v2\n      with:\n        python-version: '3.x'\n    - name: Install dependencies\n      run: |\n        pip install code2prompt llm\n    - name: Analyze codebase\n      run: |\n        code2prompt --path . | llm \"Perform a comprehensive analysis of this codebase. Identify areas for improvement, potential bugs, and suggest optimizations.\" > analysis.md\n    - name: Upload analysis\n      uses: actions\u002Fupload-artifact@v2\n      with:\n        name: code-analysis\n        path: analysis.md\n```\n\n## Understanding Tokens and Token Types in Code2Prompt\n\nTokens are the basic units of text that language models process. They can be words, parts of words, or even punctuation marks. Different tokenizer encodings split text into tokens in various ways. Code2Prompt supports multiple token types through its `--encoding` option, with \"cl100k_base\" as the default. This encoding, used by models like GPT-3.5 and GPT-4, is adept at handling code and technical content. Other common encodings include \"p50k_base\" (used by earlier GPT-3 models) and \"r50k_base\" (used by models like CodeX).\n\nTo count tokens in your generated prompt, use the `--tokens` flag:\n\n```bash\ncode2prompt --path \u002Fyour\u002Fproject --tokens\n```\n\nFor a specific encoding:\n\n```bash\ncode2prompt --path \u002Fyour\u002Fproject --tokens --encoding p50k_base\n```\n\nUnderstanding token counts is crucial when working with AI models that have token limits, ensuring your prompts fit within the model's context window.\n\n### Token Price Estimation\n\nCode2Prompt now includes a powerful feature for estimating token prices across various AI providers and models. Use the `--price` option in conjunction with `--tokens` to display a comprehensive breakdown of estimated costs. This feature calculates prices based on both input and output tokens, with input tokens determined by your codebase and a default of 1000 output tokens (customizable via `--output-tokens`). You can specify a particular provider or model, or view prices across all available options. This functionality helps developers make informed decisions about AI model usage and cost management. For example:\n\n```bash\ncode2prompt --path \u002Fyour\u002Fproject --tokens --price --provider openai --model gpt-4\n```\n\nThis command will analyze your project, count the tokens, and provide a detailed price estimation for OpenAI's GPT-4 model.\n\n![](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fraphaelmansuy_code2prompt_readme_adb98f206cab.png)\n\n## 🔥 Analyzing Codebases\n\ncode2prompt now offers a powerful feature to analyze codebases and provide a summary of file extensions. Use the `--analyze` option along with the `-p` (path) option to get an overview of your project's file composition. For example:\n\n```\ncode2prompt --analyze -p code2prompt\n```\n\nResult:\n\n```\n.j2: 6 files\n.json: 1 file\n.py: 33 files\n.pyc: 56 files\n\nComma-separated list of extensions:\n.j2,.json,.py,.pyc\n```\n\nThis command will analyze the 'code2prompt' directory and display a summary of all file extensions found, including their counts. You can choose between two output formats:\n\n- Flat format (default): Lists all unique extensions alphabetically with their file counts.\n- Tree-like format: Displays extensions in a directory tree structure with counts at each level.\n\nTo use the tree-like format, add the `--format tree` option:\n\n```\ncode2prompt --analyze -p code2prompt --format tree\n```\n\nResult: \n\n```\n└── code2prompt\n    ├── utils\n    │   ├── .py\n    │   └── __pycache__\n    │       └── .pyc\n    ├── .py\n    ├── core\n    │   ├── .py\n    │   └── __pycache__\n    │       └── .pyc\n    ├── comment_stripper\n    │   ├── .py\n    │   └── __pycache__\n    │       └── .pyc\n    ├── __pycache__\n    │   └─ .pyc\n    ├── templates\n    │   └── .j2\n    └── data\n        └── .json\n\nComma-separated list of extensions:\n.j2,.json,.py,.pyc\n```\n\nThe analysis also generates a comma-separated list of file extensions, which can be easily copied and used with the `--filter` option for more targeted code processing.\n\n## 🔥 Feature Highlight: Dynamic Variable Extraction for Prompt Generation\n\n`code2prompt` offers a powerful feature for dynamic variable extraction from templates, allowing for interactive and customizable prompt generation. Using the syntax `{{input:variable_name}}`, you can easily define variables that will prompt users for input during execution. \n\nThis is particularly useful for creating flexible templates for various purposes, such as generating AI prompts for Chrome extensions. Here's an example:\n\n```jinja2\n# AI Prompt Generator for Chrome Extension\n\nGenerate a prompt for an AI to create a Chrome extension with the following specifications:\n\nExtension Name: {{input:extension_name}}\nMain Functionality: {{input:main_functionality}}\nTarget Audience: {{input:target_audience}}\n\n## Prompt:\n\nYou are an experienced Chrome extension developer. Create a detailed plan for a Chrome extension named \"{{input:extension_name}}\" that {{input:main_functionality}}. This extension is designed for {{input:target_audience}}.\n\nYour response should include:\n\n1. A brief description of the extension's purpose and functionality\n2. Key features (at least 3)\n3. User interface design considerations\n4. Potential challenges in development and how to overcome them\n5. Security and privacy considerations\n6. A basic code structure for the main components (manifest.json, background script, content script, etc.)\n\nEnsure that your plan is detailed, technically sound, and tailored to the needs of {{input:target_audience}}.\n\nStart from this codebase:\n\n---- \n\n## The codebase:\n\n\u003Ccodebase>\n```\n\nWhen you run `code2prompt` with this template, it will automatically detect the `{{input:variable_name}}` patterns and prompt the user to provide values for each variable (extension_name, main_functionality, and target_audience). This allows for flexible and interactive prompt generation, making it easy to create customized AI prompts for various Chrome extension ideas.\n\nFor example, if a user inputs:\n- Extension Name: \"ProductivityBoost\"\n- Main Functionality: \"tracks time spent on different websites and provides productivity insights\"\n- Target Audience: \"professionals working from home\"\n\nThe tool will generate a tailored prompt for an AI to create a detailed plan for this specific Chrome extension. This feature is particularly useful for developers, product managers, or anyone looking to quickly generate customized AI prompts for various projects or ideas.\n\n## 🔥 Feature Highlight \"Include File\" Feature\n\nThe code2prompt project now supports a powerful \"include file\" feature, enhancing template modularity and reusability.\n\n This feature allows you to seamlessly incorporate external file content into your main template using the `{% include %}` directive. For example, in the main `analyze-code.j2` template, you can break down complex sections into smaller, manageable files:\n\n```jinja2\n# Elite Code Analyzer and Improvement Strategist 2.0\n\n{% include 'sections\u002Frole_and_goal.j2' %}\n\n{% include 'sections\u002Fcore_competencies.j2' %}\n\n## Task Breakdown\n\n1. Initial Assessment\n{% include 'tasks\u002Finitial_assessment.j2' %}\n\n2. Multi-Dimensional Analysis (Utilize Tree of Thought)\n{% include 'tasks\u002Fmulti_dimensional_analysis.j2' %}\n\n\u002F\u002F ... other sections ...\n```\n\nThis approach allows you to organize your template structure more efficiently, improving maintainability and allowing for easy updates to specific sections without modifying the entire template. The include feature supports both relative and absolute paths, making it flexible for various project structures. By leveraging this feature, you can significantly reduce code duplication, improve template management, and create a more modular and scalable structure for your code2prompt templates.\n\n## Interactive Mode\n\nThe interactive mode allows users to select files for processing in a user-friendly manner. This feature is particularly useful when dealing with large codebases or when you want to selectively include files without manually specifying each path.\n\n### How to Use Interactive Mode\n\nTo activate interactive mode, use the `--interactive` or `-i` option when running the `code2prompt` command. Here's an example:\n\n```bash\ncode2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fproject --interactive\n```\n\n![](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fraphaelmansuy_code2prompt_readme_e70db8ddfb7c.png)\n\n\n### Features of Interactive Mode\n\n- **File Selection**: Navigate through the directory structure and select files using keyboard controls.\n- **Visual Feedback**: The interface provides visual cues to help you understand which files are selected or ignored.\n\n### Keyboard Controls\n\n- **Arrow Keys**: Navigate through the list of files.\n- **Spacebar**: Toggle the selection of a file.\n- **Enter**: Confirm your selection and proceed with the command.\n- **Esc**: Exit the interactive mode without making any changes.\n\nThis mode enhances the usability of Code2Prompt, making it easier to manage file selections in complex projects.\n\n## Configuration File\n\nCode2Prompt supports a `.code2promptrc` configuration file in JSON format for setting default options. Place this file in your project or home directory.\n\nExample `.code2promptrc`:\n\n```json\n{\n  \"suppress_comments\": true,\n  \"line_number\": true,\n  \"encoding\": \"cl100k_base\",\n  \"filter\": \"*.py,*.js\",\n  \"exclude\": \"tests\u002F*,docs\u002F*\"\n}\n```\n\n## Troubleshooting\n\n1. **Issue**: Code2Prompt is not recognizing my .gitignore file.\n   **Solution**: Run Code2Prompt from the project root, or specify the .gitignore path with `--gitignore`.\n\n2. **Issue**: The generated output is too large for my AI model.\n   **Solution**: Use `--tokens` to check the count, and refine `--filter` or `--exclude` options.\n\n3. **Issue**: Some files are not being processed.\n   **Solution**: Check for binary files or exclusion patterns. Use `--case-sensitive` if needed.\n\n## Roadmap\n\n   - [X] Interactive filtering\n   - [X] Include system in template to promote re-usability of sub templates.\n   - [X] Support of input variables\n   - [ ] Tokens count for Anthropic Models and other models such as LLama3 or Mistral\n   - [X] Cost Estimations for main LLM providers based on token count\n   - [ ] Integration with [qllm](https:\u002F\u002Fgithub.com\u002Fquantalogic\u002Fqllm) (Quantalogic LLM)\n   - [ ] Embedding of file summary in SQL-Lite\n   - [ ] Intelligence selection of file based on an LLM\n   - [ ] Git power tools (Git diff integration \u002F PR Assisted Review)\n\n## Contributing\n\nContributions to Code2Prompt are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.\n\n## License\n\nCode2Prompt is released under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n---\n\n⭐ If you find Code2Prompt useful, please give us a star on GitHub! It helps us reach more developers and improve the tool. ⭐\n\n## Project Growth\n[![Star History Chart](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fraphaelmansuy_code2prompt_readme_c4bb770bc9dc.png)](https:\u002F\u002Fstar-history.com\u002F#raphaelmansuy\u002Fcode2prompt&Date)\n\nMade with ❤️ by Raphaël MANSUY. Founder of [Quantalogic](https:\u002F\u002Fwww.quantalogic.app). Creator of [qllm](https:\u002F\u002Fgithub.com\u002Fquantalogic\u002Fqllm).\n","# Code2Prompt\n\n[![PyPI版本](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Fcode2prompt.svg)](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Fcode2prompt)\n\n[![GitHub Star数](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fraphaelmansuy\u002Fcode2prompt.svg)](https:\u002F\u002Fgithub.com\u002Fraphaelmansuy\u002Fcode2prompt\u002Fstargazers)\n[![GitHub Fork数](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fforks\u002Fraphaelmansuy\u002Fcode2prompt.svg)](https:\u002F\u002Fgithub.com\u002Fraphaelmansuy\u002Fcode2prompt\u002Fnetwork\u002Fmembers)\n[![PyPI下载量](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fdm\u002Fqllm.svg)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fcode2prompt\u002F)\n[![PyPI版本](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fqllm.svg)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fcode2prompt\u002F)\n[![许可证：MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow.svg)](https:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT)\n\nCode2Prompt 是一款功能强大的命令行工具，能够从代码库中生成全面的提示词，旨在简化开发者与大型语言模型（LLM）之间的交互，以实现代码分析、文档生成和改进任务。\n\n## 目录\n\n1. [为什么选择 Code2Prompt？](#why-code2prompt)\n2. [特性](#features)\n3. [安装](#installation)\n4. [快速入门](#getting-started)\n5. [快速开始](#quick-start)\n6. [使用方法](#usage)\n7. [选项](#options)\n8. [示例](#examples)\n9. [模板系统](#templating-system)\n10. [与 LLM CLI 集成](#integration-with-llm-cli)\n11. [GitHub Actions 集成](#github-actions-integration)\n12. [配置文件](#configuration-file)\n13. [故障排除](#troubleshooting)\n14. [贡献](#contributing)\n15. [许可证](#license)\n\n# Code2Prompt：将你的代码库转化为适合 AI 的提示词\n\n[![PyPI版本](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Fcode2prompt.svg)](https:\u002F\u002Fbadge.fury.io\u002Fpy\u002Fcode2prompt)\n[![GitHub Star数](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fraphaelmansuy\u002Fcode2prompt.svg)](https:\u002F\u002Fgithub.com\u002Fraphaelmansuy\u002Fcode2prompt\u002Fstargazers)\n[![许可证：MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow.svg)](https:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT)\n\n![](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fraphaelmansuy_code2prompt_readme_80f28bda8a9b.png)\n\n## 为你的 AI 辅助开发注入强大动力\n\nCode2Prompt 是一款功能强大且开源的命令行工具，它架起了你的代码库与大型语言模型（LLM）之间的桥梁。通过将整个项目转化为全面、适合 AI 的提示词，Code2Prompt 让你能够充分发挥 AI 在代码分析、文档生成和改进任务中的潜力。\n\n### 🚀 核心功能\n\n- **全面的代码库表示**：生成结构清晰的 Markdown 提示词，完整捕捉项目的精髓，让 LLM 更容易理解上下文。\n- **智能源码树生成**：创建清晰的分层代码库结构视图，便于更好地导航和理解项目。\n- **可自定义的提示词模板**：利用 Jinja2 模板定制输出内容，以适应特定的 AI 任务，提升生成提示词的相关性。\n- **智能 Token 管理**：统计并优化 Token 数量，确保与各种 LLM 的 Token 限制兼容，避免处理时出错。\n- **Gitignore 集成**：尊重项目的 .gitignore 规则，准确反映代码库内容，确保无关文件不会被纳入处理。\n- **灵活的文件处理**：通过强大的 glob 模式筛选和排除文件，让你掌控哪些文件会被纳入提示词生成。\n- **自定义语法高亮**：使用 `--syntax-map` 选项，为自定义文件扩展名指定特定的语法高亮。例如，你可以指定 `.inc` 文件应被视为 `bash` 脚本。\n- **剪贴板就绪**：即时将生成的提示词复制到剪贴板，方便快速进行 AI 对话，简化工作流程。\n- **多种输出选项**：保存到文件或直接在控制台显示，提供灵活的使用方式。\n- **增强代码可读性**：为源码块添加行号，便于精准引用，更容易讨论代码的特定部分。\n- **包含文件**：支持模板导入，允许模块化设计模板。\n- **输入变量**：支持模板中的输入变量，根据用户输入动态生成提示词。\n\n### 💡 为什么选择 Code2Prompt？\n\n- **上下文理解**：为 LLM 提供项目的全面视图，以便更准确地给出建议和分析。\n- **一致性提升**：在整个项目中保持编码风格和规范，提高代码质量。\n- **高效重构**：实现更好的依赖关系分析和更智能的重构建议，节省时间和精力。\n- **改善文档生成**：生成符合上下文的文档，真实反映代码库内容，提升可维护性。\n- **模式识别**：帮助 LLM 学习并应用项目特有的模式和惯用法，提升 AI 交互的质量。\n\n改变你与 AI 进行软件开发互动的方式。借助 Code2Prompt，你在每次 AI 对话中都能充分挖掘代码库的潜力。\n\n准备好提升你的 AI 辅助开发水平了吗？让我们一起出发吧！🏊‍♂️\n\n## 安装\n\n选择以下任一方式安装 Code2Prompt：\n\n### 使用 pip\n\n```bash\npip install code2prompt\n```\n\n### 使用 [pipx](https:\u002F\u002Fgithub.com\u002Fpypa\u002Fpipx)（推荐）\n\n```bash\npipx install code2prompt\n```\n\n## 快速入门\n\n要开始使用 Code2Prompt，请按照以下步骤操作：\n\n1. **安装 Code2Prompt**：使用上述任一安装方法。\n2. **准备你的代码库**：确保项目组织良好，并根据需要准备好 `.gitignore` 文件。\n3. **运行 Code2Prompt**：使用命令行从你的代码库生成提示词。\n\n例如，要从单个 Python 文件生成提示词，运行：\n\n```bash\ncode2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fscript.py\n```\n\n## 快速开始\n\n1. 从单个 Python 文件生成提示词：\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fscript.py\n   ```\n\n2. 处理整个项目目录并保存输出：\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fproject --output project_summary.md\n   ```\n\n3. 为多个文件生成提示词，排除测试文件：\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fsrc --path \u002Fpath\u002Fto\u002Flib --exclude \"*\u002Ftests\u002F*\" --output codebase_summary.md\n   ```\n\n## 使用方法\n\nCode2Prompt 的基本语法为：\n\n```bash\ncode2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fcode [OPTIONS]\n```\n\n对于多个路径：\n\n```bash\ncode2prompt --path \u002Fpath\u002Fto\u002Fdir1 --path \u002Fpath\u002Fto\u002Ffile2.py [OPTIONS]\n```\n\n### 自定义语法高亮\n\n要将自定义文件扩展名与特定的语法高亮关联起来，请使用 `--syntax-map` 选项。此选项允许您以 `扩展名:语法` 的格式指定映射关系。例如：\n\n```\ncode2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fcode --syntax-map \"inc:bash,customext:python,ext2:javascript\"\n```\n\n该命令会将 `.inc` 文件视为 `bash` 脚本，`.customext` 文件视为 `python`，`.ext2` 文件视为 `javascript`。\n\n您也可以使用多个 `--syntax-map` 参数，或用逗号分隔多个映射关系：\n\n```\ncode2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fscript.py --syntax-map \"inc:bash\"\n```\n\n```\ncode2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fproject --syntax-map \"inc:bash,txt:markdown\" --output project_summary.md\n```\n\n```\ncode2prompt --path \u002Fpath\u002Fto\u002Fsrc --path \u002Fpath\u002Fto\u002Flib --syntax-map \"inc:bash,customext:python\" --output codebase_summary.md\n```\n\n## 选项\n\n| 选项 | 短标志 | 描述 |\n|--------|-------|-------------|\n| `--path` | `-p` | 要处理的目录或文件的路径（必选，可指定多个） |\n| `--output` | `-o` | 输出 Markdown 文件的名称 |\n| `--gitignore` | `-g` | .gitignore 文件的路径 |\n| `--filter` | `-f` | 以逗号分隔的过滤模式，用于包含文件（例如：*.py,*.js） |\n| `--exclude` | `-e` | 以逗号分隔的排除模式，用于排除文件（例如：*.txt,*.md） |\n| `--case-sensitive` | | 执行区分大小写的模式匹配 |\n| `--suppress-comments` | `-s` | 从代码文件中去除注释 |\n| `--line-number` | `-ln` | 在源代码块中添加行号 |\n| `--no-codeblock` | | 禁用将代码包裹在 Markdown 代码块中 |\n| `--template` | `-t` | 指定用于自定义提示生成的 Jinja2 模板文件的路径 |\n| `--tokens` | | 显示生成提示的标记数 |\n| `--encoding` | | 指定使用的分词器编码（默认：“cl100k_base”） |\n| `--create-templates` | | 创建包含示例模板的 templates 目录 |\n| `--version` | `-v` | 显示版本并退出 |\n| `--log-level` | | 设置日志级别（例如：DEBUG、INFO、WARNING、ERROR、CRITICAL） |\n| `--interactive` | `-i` | 激活交互模式以选择文件 |\n| `--syntax-map` | | 将自定义文件扩展名与特定的语法高亮关联起来（例如：“inc:bash,customext:python,ext2:javascript”） |\n\n## 命令参数\n\n### `--filter` 或 `-f` 与 `--exclude` 或 `-e`\n\n`--filter` 和 `--exclude` 选项允许您指定应包含或排除处理的文件或目录的模式。\n\n#### 语法：\n```\n--filter \"PATTERN1,PATTERN2,...\"\n--exclude \"PATTERN1,PATTERN2,...\"\n```\n或\n```\n-f \"PATTERN1,PATTERN2,...\"\n-e \"PATTERN1,PATTERN2,...\"\n```\n\n#### 描述：\n- 两个选项都接受以逗号分隔的模式列表。\n- 模式可以包含通配符 (`*`) 和目录指示符 (`**`)。\n- 默认区分大小写（使用 `--case-sensitive` 标志可更改此行为）。\n- `--exclude` 模式优先于 `--filter` 模式。\n\n#### 示例：\n\n1. 只包含 Python 文件：\n   ```\n   --filter \"**.py\"\n   ```\n\n2. 排除所有 Markdown 文件：\n   ```\n   --exclude \"**.md\"\n   ```\n\n3. 包含 src 目录中的特定文件类型：\n   ```\n   --filter \"src\u002F**.{js,ts}\"\n   ```\n\n4. 排除多个文件类型和特定目录：\n   ```\n   --exclude \"**.log,**.tmp,**\u002Fnode_modules\u002F**\"\n   ```\n\n5. 包含所有文件，但排除 'test' 目录中的文件：\n   ```\n   --filter \"**\" --exclude \"**\u002Ftest\u002F**\"\n   ```\n\n6. 复杂过滤（包含 JavaScript 文件，排除 minified 和测试文件）：\n   ```\n   --filter \"**.js\" --exclude \"**.min.js,**test**.js\"\n   ```\n\n7. 包含所有目录中的特定文件：\n   ```\n   --filter \"**\u002Fconfig.json,**\u002FREADME.md\"\n   ```\n\n8. 排除临时文件和目录：\n   ```\n   --exclude \"**\u002F.cache\u002F**,**\u002Ftmp\u002F**,**.tmp\"\n   ```\n\n9. 包含源文件，但排除构建输出：\n   ```\n   --filter \"src\u002F**\u002F*.{js,ts}\" --exclude \"**\u002Fdist\u002F**,**\u002Fbuild\u002F**\"\n   ```\n\n10. 排除版本控制和 IDE 特定文件：\n    ```\n    --exclude \"**\u002F.git\u002F**,**\u002F.vscode\u002F**,**\u002F.idea\u002F**\"\n    ```\n\n#### 注意事项：\n\n- 始终对模式使用双引号，以防止 shell 解释特殊字符。\n- 模式会针对每个文件的完整路径进行匹配，相对于项目根目录。\n- `**` 通配符匹配任意数量的目录。\n- 单个 `*` 匹配单个目录或文件名中的任意字符。\n- 使用逗号分隔同一选项中的多个模式。\n- 结合使用 `--filter` 和 `--exclude` 可实现对处理文件的精细控制。\n\n#### 最佳实践：\n\n1. 先使用较宽泛的模式，再根据需要逐步细化。\n2. 首先在项目的较小子集上测试您的模式。\n3. 如果需要区分大小写相似的文件名，请使用 `--case-sensitive` 标志。\n4. 对于复杂项目，建议使用配置文件管理您的过滤和排除模式。\n\n通过有效且安全地使用 `--filter` 和 `--exclude` 选项（配合正确的引号），您可以精确控制项目中哪些文件会被处理，从而确保命令执行的准确性和安全性。\n\n## 示例\n\n1. 为 Python 库生成文档：\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Flibrary --output library_docs.md --suppress-comments --line-number --filter \"*.py\"\n   ```\n\n2. 准备代码库摘要以进行代码审查，重点关注 JavaScript 和 TypeScript 文件：\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fproject --filter \"*.js,*.ts\" --exclude \"node_modules\u002F*,dist\u002F*\" --template code_review.j2 --output code_review.md\n   ```\n\n3. 为 AI 模型创建输入以提出改进建议，重点关注特定目录：\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fsrc\u002Fcomponents --suppress-comments --tokens --encoding cl100k_base --output ai_input.md\n   ```\n\n4. 分析多语言项目的注释密度：\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fproject --template comment_density.j2 --output comment_analysis.md --filter \"*.py,*.js,*.java\"\n   ```\n\n5. 为一组特定文件生成提示，并添加行号：\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fimportant_file1.py --path \u002Fpath\u002Fto\u002Fimportant_file2.js --line-number --output critical_files.md\n   ```\n\n## 模板系统\n\nCode2Prompt 支持使用 Jinja2 模板进行自定义输出格式化。要使用自定义模板：\n\n```bash\ncode2prompt --path \u002Fpath\u002Fto\u002Fcode --template \u002Fpath\u002Fto\u002Fyour\u002Ftemplate.j2\n```\n\n### 创建模板示例\n\n使用 `--create-templates` 命令生成示例模板：\n\n```bash\ncode2prompt --create-templates\n```\n\n这将在 `templates` 目录下创建一些 Jinja2 示例模板，包括：\n\n- [default.j2](.\u002Fcode2prompt\u002F\u002Ftemplates\u002Fdefault.j2)：通用模板\n- [analyze-code.j2](.\u002Fcode2prompt\u002Ftemplates\u002Fanalyze-code.j2)：用于详细代码分析\n- [code-review.j2](.\u002Fcode2prompt\u002Ftemplates\u002Fcode-review.j2)：用于全面代码审查\n- [create-readme.j2](.\u002Fcode2prompt\u002Ftemplates\u002Fcreate-readme.j2)：帮助生成 README 文件\n- [improve-this-prompt.j2](.\u002Fcode2prompt\u002Ftemplates\u002Fimprove-this-prompt.j2)：用于优化 AI 提示词\n\n有关完整模板文档，请参阅 [文档模板化](.\u002FTEMPLATE.md)。\n\n## 与 LLM CLI 的集成\n\nCode2Prompt 可以与 Simon Willison 的 [llm](https:\u002F\u002Fgithub.com\u002Fsimonw\u002Fllm) CLI 工具集成，以增强代码分析功能，或与 [qllm](https:\u002F\u002Fgithub.com\u002Fquantalogic\u002Fqllm) 集成，亦或是为 Rust 爱好者提供 [hiramu-cli](https:\u002F\u002Fgithub.com\u002Fraphaelmansuy\u002Fhiramu-cli)。\n\n### 安装\n\n```bash\npip install code2prompt llm\n```\n\n### 基本用法\n\n1. 生成代码摘要并用 LLM 进行分析：\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fproject | llm \"分析这个代码库，提供其结构和潜在改进的见解\"\n   ```\n\n2. 处理特定文件并获取重构建议：\n   ```bash\n   code2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fscript.py | llm \"为这段代码提出重构改进建议\"\n   ```\n\n更多高级用法，请参考完整文档中的 [与 LLM CLI 的集成](#integration-with-llm-cli) 部分。\n\n## GitHub Actions 集成\n\n您可以将 Code2Prompt 集成到您的 GitHub Actions 工作流中。以下是一个示例：\n\n```yaml\nname: 代码分析\non: [push]\njobs:\n  analyze-code:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions\u002Fcheckout@v2\n    - name: 设置 Python\n      uses: actions\u002Fsetup-python@v2\n      with:\n        python-version: '3.x'\n    - name: 安装依赖\n      run: |\n        pip install code2prompt llm\n    - name: 分析代码库\n      run: |\n        code2prompt --path . | llm \"对这个代码库进行全面分析。识别需要改进的地方、潜在错误，并提出优化建议。\" > analysis.md\n    - name: 上传分析结果\n      uses: actions\u002Fupload-artifact@v2\n      with:\n        name: code-analysis\n        path: analysis.md\n```\n\n## 理解 Code2Prompt 中的标记与标记类型\n\n标记是语言模型处理文本的基本单元。它们可以是单词、单词的一部分，甚至标点符号。不同的分词器编码会以不同方式将文本分割成标记。Code2Prompt 通过 `--encoding` 选项支持多种标记类型，默认为 \"cl100k_base\"。这种编码被 GPT-3.5 和 GPT-4 等模型所使用，擅长处理代码和技术内容。其他常见编码还包括 \"p50k_base\"（用于早期 GPT-3 模型）和 \"r50k_base\"（用于 CodeX 等模型）。\n\n要统计生成提示词中的标记数，使用 `--tokens` 标志：\n\n```bash\ncode2prompt --path \u002Fyour\u002Fproject --tokens\n```\n\n对于特定编码：\n\n```bash\ncode2prompt --path \u002Fyour\u002Fproject --tokens --encoding p50k_base\n```\n\n了解标记数量在使用有标记限制的 AI 模型时至关重要，确保您的提示词符合模型的上下文窗口要求。\n\n### 标记价格估算\n\nCode2Prompt 现在新增了一个强大的功能，可估算各种 AI 提供商和模型的标记价格。结合 `--tokens` 使用 `--price` 选项，即可显示详细的成本估算。此功能根据输入和输出标记计算价格，其中输入标记由您的代码库决定，默认输出标记为 1000 个（可通过 `--output-tokens` 自定义）。您可以指定特定提供商或模型，也可以查看所有可用选项的价格。这一功能有助于开发者做出明智的 AI 模型使用和成本管理决策。例如：\n\n```bash\ncode2prompt --path \u002Fyour\u002Fproject --tokens --price --provider openai --model gpt-4\n```\n\n该命令将分析您的项目，统计标记数，并为 OpenAI 的 GPT-4 模型提供详细的价格估算。\n\n![](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fraphaelmansuy_code2prompt_readme_adb98f206cab.png)\n\n## 🔥 分析代码库\n\ncode2prompt 现在提供了一个强大的功能，可分析代码库并提供文件扩展名的汇总信息。使用 `--analyze` 选项与 `-p`（路径）选项，即可获得项目文件组成的概览。例如：\n\n```\ncode2prompt --analyze -p code2prompt\n```\n\n结果：\n\n```\n.j2: 6 个文件\n.json: 1 个文件\n.py: 33 个文件\n.pyc: 56 个文件\n\n以逗号分隔的扩展名列表：\n.j2,.json,.py,.pyc\n```\n\n该命令将分析 'code2prompt' 目录，并显示所有找到的文件扩展名及其计数。您可以选择两种输出格式：\n\n- 平铺格式（默认）：按字母顺序列出所有唯一扩展名及其文件计数。\n- 树状格式：以目录树结构显示扩展名，每层都附带计数。\n\n要使用树状格式，添加 `--format tree` 选项：\n\n```\ncode2prompt --analyze -p code2prompt --format tree\n```\n\n结果：\n\n```\n└── code2prompt\n    ├── utils\n    │   ├── .py\n    │   └── __pycache__\n    │       └── .pyc\n    ├── .py\n    ├── core\n    │   ├── .py\n    │   └── __pycache__\n    │       └── .pyc\n    ├── comment_stripper\n    │   ├── .py\n    │   └── __pycache__\n    │       └── .pyc\n    ├── __pycache__\n    │   └─ .pyc\n    ├── templates\n    │   └── .j2\n    └── data\n        └── .json\n\n以逗号分隔的扩展名列表：\n.j2,.json,.py,.pyc\n```\n\n分析还会生成一个以逗号分隔的文件扩展名列表，可轻松复制并配合 `--filter` 选项进行更精准的代码处理。\n\n## 🔥 功能亮点：动态变量提取用于提示词生成\n\n`code2prompt` 提供了从模板中动态提取变量的强大功能，允许交互式且可定制的提示词生成。通过语法 `{{input:variable_name}}`，您可以轻松定义变量，这些变量会在执行时提示用户输入。\n\n这对于创建灵活的模板特别有用，可用于各种目的，比如为 Chrome 扩展生成 AI 提示词。以下是一个示例：\n\n```jinja2\n# Chrome 扩展的 AI 提示词生成器\n\n生成一个 AI 提示词，用于创建一个 Chrome 扩展，具体要求如下：\n\n扩展名称：{{input:extension_name}}\n主要功能：{{input:main_functionality}}\n目标受众：{{input:target_audience}}\n\n## 提示：\n\n你是一位经验丰富的Chrome扩展开发者。请为名为“{{input:extension_name}}”的Chrome扩展制定一份详细计划，该扩展的核心功能为{{input:main_functionality}}。此扩展专为{{input:target_audience}}设计。\n\n你的回复应包括：\n\n1. 扩展的简要描述及其功能\n2. 核心功能（至少3个）\n3. 用户界面设计考虑\n4. 开发过程中可能遇到的挑战及应对策略\n5. 安全与隐私考量\n6. 主要组件的基本代码结构（manifest.json、后台脚本、内容脚本等）\n\n请确保你的计划详尽、技术可行，并针对{{input:target_audience}}的需求量身定制。\n\n从以下代码库开始：\n\n---- \n\n## 代码库：\n\n\u003Ccodebase>\n```\n\n当你使用此模板运行`code2prompt`时，它会自动检测`{{input:variable_name}}`模式，并提示用户为每个变量（扩展名、主要功能和目标受众）提供值。这使得提示生成更加灵活且互动性强，便于为各种Chrome扩展创意快速生成定制化的AI提示。\n\n例如，如果用户输入：\n- 扩展名：“ProductivityBoost”\n- 主要功能：“追踪在不同网站上花费的时间并提供生产力洞察”\n- 目标受众：“居家办公的专业人士”\n\n该工具将为AI生成一份针对此特定Chrome扩展的详细计划。这一功能尤其适合开发者、产品经理或任何希望快速为各类项目或创意生成定制化AI提示的人士。\n\n## 🔥 功能亮点：“包含文件”功能\n\ncode2prompt项目现支持强大的“包含文件”功能，提升了模板的模块化与可重用性。\n\n此功能允许你通过`{% include %}`指令，无缝地将外部文件内容引入主模板。例如，在主模板`analyze-code.j2`中，你可以将复杂部分拆解成更小、更易管理的文件：\n\n```jinja2\n# 精英代码分析与改进策略师2.0\n\n{% include 'sections\u002Frole_and_goal.j2' %}\n\n{% include 'sections\u002Fcore_competencies.j2' %}\n\n## 任务分解\n\n1. 初步评估\n{% include 'tasks\u002Finitial_assessment.j2' %}\n\n2. 多维度分析（运用思维树）\n{% include 'tasks\u002Fmulti_dimensional_analysis.j2' %}\n\n\u002F\u002F ... 其他章节 ...\n```\n\n这种方式让你能更高效地组织模板结构，提升可维护性，同时便于对特定部分进行更新而无需修改整个模板。包含功能支持相对路径和绝对路径，适用于各种项目结构。借助这一功能，你可以显著减少代码重复，改善模板管理，打造更模块化、更具扩展性的code2prompt模板结构。\n\n## 交互模式\n\n交互模式让用户能够以更友好的方式选择待处理的文件。这一功能在处理大型代码库或希望有选择性地包含文件而无需手动指定每个路径时尤为有用。\n\n### 如何使用交互模式\n\n要激活交互模式，请在运行`code2prompt`命令时使用`--interactive`或`-i`选项。以下是示例：\n\n```bash\ncode2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fproject --interactive\n```\n\n![](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fraphaelmansuy_code2prompt_readme_e70db8ddfb7c.png)\n\n\n### 交互模式的功能\n\n- **文件选择**：通过键盘控制浏览目录结构并选择文件。\n- **视觉反馈**：界面提供视觉提示，帮助你了解哪些文件已被选中或忽略。\n\n### 键盘控制\n\n- **方向键**：在文件列表中导航。\n- **空格键**：切换文件的选择状态。\n- **回车键**：确认选择并继续执行命令。\n- **Esc键**：退出交互模式而不做任何更改。\n\n这一模式提升了Code2Prompt的易用性，让你在复杂项目中更轻松地管理文件选择。\n\n## 配置文件\n\nCode2prompt支持JSON格式的`.code2promptrc`配置文件，用于设置默认选项。请将此文件放置在你的项目目录或主目录中。\n\n`.code2promptrc`示例：\n\n```json\n{\n  \"suppress_comments\": true,\n  \"line_number\": true,\n  \"encoding\": \"cl100k_base\",\n  \"filter\": \"*.py,*.js\",\n  \"exclude\": \"tests\u002F*,docs\u002F*\"\n}\n```\n\n## 故障排除\n\n1. **问题**：Code2prompt未识别我的.gitignore文件。\n   **解决方案**：从项目根目录运行Code2prompt，或使用`--gitignore`指定.gitignore路径。\n\n2. **问题**：生成的输出对我的AI模型来说太大。\n   **解决方案**：使用`--tokens`检查令牌数量，并优化`--filter`或`--exclude`选项。\n\n3. **问题**：某些文件未被处理。\n   **解决方案**：检查二进制文件或排除模式。如有需要，使用`--case-sensitive`。\n\n## 路线图\n\n   - [X] 交互式过滤\n   - [X] 在模板中加入包含系统，促进子模板的可重用性。\n   - [X] 支持输入变量\n   - [ ] 针对Anthropic模型及其他模型（如LLama3或Mistral）的令牌计数\n   - [X] 根据令牌数量估算主流LLM提供商的成本\n   - [ ] 与[qllm](https:\u002F\u002Fgithub.com\u002Fquantalogic\u002Fqllm)（Quantalogic LLM）集成\n   - [ ] 将文件摘要嵌入SQL-Lite\n   - [ ] 基于LLM的文件智能选择\n   - [ ] Git增强工具（Git diff集成\u002FPR辅助评审）\n\n## 贡献\n\n欢迎为Code2prompt贡献！请阅读我们的[贡献指南](CONTRIBUTING.md)，了解我们的行为准则以及提交拉取请求的流程。\n\n## 许可协议\n\nCode2prompt采用MIT许可证发布。详情请参阅[LICENSE](LICENSE)文件。\n\n---\n\n⭐ 如果你觉得Code2prompt对你有帮助，请在GitHub上给我们点个星！这有助于我们触达更多开发者并改进工具。⭐\n\n## 项目成长\n[![Star History Chart](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fraphaelmansuy_code2prompt_readme_c4bb770bc9dc.png)](https:\u002F\u002Fstar-history.com\u002F#raphaelmansuy\u002Fcode2prompt&Date)\n\n由Raphaël MANSUY用❤️制作。[Quantalogic](https:\u002F\u002Fwww.quantalogic.app)创始人。[qllm](https:\u002F\u002Fgithub.com\u002Fquantalogic\u002Fqllm)创作者。","# Code2Prompt 快速上手指南\n\nCode2Prompt 是一款强大的命令行工具，能将整个代码库转换为结构清晰、适合大语言模型（LLM）处理的 Prompt。它帮助开发者高效地进行代码分析、文档生成和代码优化。\n\n## 环境准备\n\n- **操作系统**：支持 Windows、macOS 和 Linux\n- **Python 版本**：Python 3.8 或更高版本\n- **前置依赖**：\n  - `pip` 或 `pipx`（推荐使用 `pipx` 以避免环境污染）\n  - 可选：项目根目录下包含 `.gitignore` 文件以排除无关文件\n\n> 💡 提示：国内用户可使用清华或阿里云镜像源加速安装。\n\n## 安装步骤\n\n### 方法一：使用 pip（通用）\n\n```bash\npip install code2prompt -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n### 方法二：使用 pipx（推荐，隔离环境）\n\n```bash\npipx install code2prompt\n```\n\n如未安装 `pipx`，可先通过以下命令安装：\n\n```bash\npip install pipx -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\npipx ensurepath\n```\n\n## 基本使用\n\n### 1. 处理单个文件\n\n将单个 Python 文件转换为 AI 友好的 Prompt 并输出到终端：\n\n```bash\ncode2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fscript.py\n```\n\n### 2. 处理整个项目并保存结果\n\n扫描整个项目目录，生成 Markdown 格式的总结文件：\n\n```bash\ncode2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fproject --output project_summary.md\n```\n\n### 3. 多路径处理并排除测试文件\n\n同时处理多个目录，并排除测试相关文件：\n\n```bash\ncode2prompt --path \u002Fpath\u002Fto\u002Fsrc --path \u002Fpath\u002Fto\u002Flib --exclude \"*\u002Ftests\u002F*\" --output codebase_summary.md\n```\n\n### 4. 添加行号与自定义语法高亮\n\n为代码块添加行号，并指定特殊扩展名的语法高亮：\n\n```bash\ncode2prompt --path \u002Fpath\u002Fto\u002Fyour\u002Fproject --line-number --syntax-map \"inc:bash,customext:python\" --output summary.md\n```\n\n生成的内容可直接复制粘贴至任意 LLM 对话界面，或用于自动化工作流。","资深后端工程师小李正接手一个遗留的微服务项目，需要让 AI 助手在两天内梳理清楚复杂的业务逻辑并生成技术文档。\n\n### 没有 code2prompt 时\n- **上下文割裂**：只能逐个文件复制代码粘贴给 AI，导致模型无法理解模块间的调用关系和整体架构。\n- **手动过滤繁琐**：需要人工剔除测试文件、配置文件和依赖库，稍有不慎就会混入无关噪音，干扰 AI 判断。\n- **引用定位困难**：生成的代码片段缺乏行号，当 AI 指出“第 50 行有逻辑错误”时，难以快速对应到具体文件的实际位置。\n- **Token 超限风险**：盲目粘贴大量代码容易超出大模型的上下文窗口限制，导致关键信息被截断或请求直接失败。\n\n### 使用 code2prompt 后\n- **全景视角呈现**：一键将整个项目转换为带目录树结构的 Markdown 文件，AI 瞬间掌握项目全貌与文件依赖脉络。\n- **智能规则过滤**：自动识别 `.gitignore` 规则并排除无关文件，确保输入给 AI 的每一份代码都是核心业务逻辑。\n- **精准行号索引**：自动为所有代码块添加行号，小李能迅速根据 AI 的反馈定位到具体代码行，沟通效率大幅提升。\n- **可控输出规模**：内置 Token 计数功能帮助优化提示词长度，既保证了信息完整性，又完美适配不同模型的上下文限制。\n\ncode2prompt 将碎片化的代码库转化为结构化的 AI 语境，让开发者从繁琐的“搬运工”变回专注逻辑的“架构师”。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fraphaelmansuy_code2prompt_80f28bda.png","raphaelmansuy","Raphael MANSUY","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fraphaelmansuy_822542be.jpg","CTO - ELITIZON Ltd\r\n\r\n🍵  Green Tea addict\r\n\r\n🚀  Maker \r\n\r\n 📚 Life learner\r\n","Elitizon","Hong Kong SAR",null,"https:\u002F\u002Fwww.elitizon.com","https:\u002F\u002Fgithub.com\u002Fraphaelmansuy",[85,89,93],{"name":86,"color":87,"percentage":88},"Python","#3572A5",88.4,{"name":90,"color":91,"percentage":92},"Jinja","#a52a22",11.5,{"name":94,"color":95,"percentage":96},"Shell","#89e051",0,886,58,"2026-03-29T21:15:04","MIT",1,"Linux, macOS, Windows","未说明",{"notes":105,"python":106,"dependencies":107},"该工具为命令行实用程序，用于将代码库转换为 LLM 提示词，不涉及深度学习模型训练或推理，因此无 GPU 和大内存需求。推荐使用 pipx 进行隔离安装。支持通过 .gitignore 和 glob 模式灵活过滤文件。","未说明 (通过 pip\u002Fpipx 安装，通常需 Python 3.7+)",[108,109,110,111],"jinja2","tiktoken","pathspec","pyperclip",[13,53,26],[114,115,116,117],"cli","python3","tools","llm","2026-03-27T02:49:30.150509","2026-04-06T05:16:11.214930",[121,126,131],{"id":122,"question_zh":123,"answer_zh":124,"source_url":125},9330,"如何分析代码库并获取所有文件扩展名的摘要列表，以便用于 --filter 选项？","可以使用 `--analyze` 选项来分析代码库并提供文件扩展名摘要。该功能已在 v0.6.13 版本中交付。\n\n安装或更新命令：\n`pipx install code2prompt --force`\n\n使用示例：\n`code2prompt --path $projectdir --analyze --gitignore $gitignoredir --suppress-comments --tokens --encoding $encoding --case-sensitive --output project_summary_analyze.md`\n\n这将输出类似 `.py: 2 files`, `.php: 5 files` 的统计列表，方便复制修改后用于 `--filter`。","https:\u002F\u002Fgithub.com\u002Fraphaelmansuy\u002Fcode2prompt\u002Fissues\u002F9",{"id":127,"question_zh":128,"answer_zh":129,"source_url":130},9331,"使用 --tokens 选项时，为什么 Token 计数显示在输出开头而不是结尾？","这是一个已知问题，Token 计数原本应在输出末尾以便用户在处理大代码库时直接查看。该问题已在 **v0.8.1** 版本中修复。\n\n请升级工具以解决此问题：\n`pipx install code2prompt --force` (或使用您常用的升级命令更新至 0.8.1 及以上版本)。","https:\u002F\u002Fgithub.com\u002Fraphaelmansuy\u002Fcode2prompt\u002Fissues\u002F14",{"id":132,"question_zh":133,"answer_zh":134,"source_url":135},9332,"为什么配置了 --exclude 选项或在配置文件中设置 exclude，但指定的目录（如 tests\u002F*）仍未被排除？","这是之前版本的一个 Bug，导致 `--exclude` 参数无法正常工作。该问题已在 **v0.6.7** 版本中修复。\n\n解决方法是重新安装最新版本：\n`pipx install code2prompt --force`\n\n修复后，您可以在命令行或配置文件（JSON 格式）中正常使用 `\"exclude\": \"tests\u002F*,prototypes\u002F*\"` 来排除特定目录。","https:\u002F\u002Fgithub.com\u002Fraphaelmansuy\u002Fcode2prompt\u002Fissues\u002F5",[]]