Repository Instructions

发布时间:2026/9/10 15:01:52
Repository Instructions Repository Instructions【免费下载链接】repomix Repomix is a powerful tool that packs your entire repository into a single, AI-friendly file. Perfect for when you need to feed your codebase to Large Language Models (LLMs) or other AI tools like Claude, ChatGPT, DeepSeek, Perplexity, Gemini, Gemma, Llama, Grok, and more.项目地址: https://gitcode.com/GitHub_Trending/rep/repomixThis repository contains the source code for the Repomix tool. Please follow these guidelines when analyzing the code:Focus on the core functionality in thesrc/coredirectory.Pay special attention to the security checks insrc/core/security.Ignore any files in thetestsdirectory.这段内容会被完整地包含进输出。在默认 XML 输出风格下对应生成如下片段 xml instruction # Repository Instructions This repository contains the source code for the Repomix tool. Please follow these guidelines when analyzing the code: 1. Focus on the core functionality in the src/core directory. 2. Pay special attention to the security checks in src/core/security. 3. Ignore any files in the tests directory. /instruction可以看到指令内容被原样保留包括 Markdown 标题、列表并由instruction标签包裹便于 AI 与后续解析工具识别。输出格式中的呈现方式自定义指令并非只出现在 XML 输出中Repomix 的每种输出风格都有对应的渲染位置这可以从模板源码中直接确认XML 风格xmlStyle.ts使用{{#if instruction}}条件包裹渲染为instruction标签块Markdown 风格markdownStyle.ts渲染为# Instruction一级标题下的内容块Plain 纯文本风格plainStyle.ts以纯文本段落形式输出可解析 JSON 风格parsableStyle: true时在 outputGenerate.ts 中通过...(renderContext.instruction { instruction: renderContext.instruction })生成instruction顶层字段指令以结构化键值形式呈现便于程序化读取。由此可见无论你偏好哪种输出风格自定义指令都会以该风格最自然的形式被保留下来不会因切换格式而丢失。源码级原理指令文件如何被读取与注入自定义指令的完整数据流在 outputGenerate.ts 中清晰可见核心逻辑如下let repositoryInstruction ; if (config.output.instructionFilePath) { const instructionPath path.resolve(config.cwd, config.output.instructionFilePath); try { repositoryInstruction await fs.readFile(instructionPath, utf-8); } catch { throw new RepomixError(Instruction file not found at ${instructionPath}); } }这段实现透露出几个关键事实相对路径基于当前工作目录解析path.resolve(config.cwd, ...)说明配置中的路径是相对于运行 Repomix 时的工作目录cwd解析的因此官方示例建议将指令文件放在仓库根目录恰好与默认运行目录一致按 UTF-8 读取纯文本文件以utf-8编码读取Markdown 内容会保持原样文件缺失时直接报错若指令文件不存在会抛出Instruction file not found at 路径错误打包流程终止——这保证了输出中不会静默缺失指令未配置时优雅降级当instructionFilePath未设置或为空时repositoryInstruction保持空字符串后续模板渲染中的{{#if instruction}}条件为假指令段落不会出现在输出中。读取结果随后被放入OutputGeneratorContext第 440 行instruction: repositoryInstruction再经 createRenderContext 转发给各输出风格的模板引擎完成渲染。配置项定义与默认值从配置模式定义configSchema.ts 与默认值定义configSchema.ts可以确认instructionFilePath属于output配置节点类型为可选的字符串该字段没有默认值未配置时功能处于关闭状态它与其他output子项如headerText、style、fileSummary等平级可自由组合。值得区分的是output.headerTextheaderText 用于在输出头部添加一段固定说明文本而instructionFilePath是从外部文件读取的指令内容两者注入的位置与语义不同可根据需要同时使用。本仓库中的真实用法dogfooding 实践Repomix 项目自身就在使用该功能。仓库根目录的 repomix.config.json 中配置了{ output: { instructionFilePath: repomix-instruction.md } }【免费下载链接】repomix Repomix is a powerful tool that packs your entire repository into a single, AI-friendly file. Perfect for when you need to feed your codebase to Large Language Models (LLMs) or other AI tools like Claude, ChatGPT, DeepSeek, Perplexity, Gemini, Gemma, Llama, Grok, and more.项目地址: https://gitcode.com/GitHub_Trending/rep/repomix创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

关于本文作者

来自尧图内容编辑团队

尧图内容编辑团队 内容团队

尧图内容编辑团队

本文由尧图网络内容编辑团队执笔。团队由资深项目经理、前端工程师与设计师组成,所有内容均来自亲手交付的真实项目,先讲清问题、再给出可落地的解法。尧图深耕北京网站建设十年,服务过京华建材集团、智造科技等各行业客户,把一线经验沉淀为可复用的行业观察。

  • 十年建站经验,覆盖建材、制造、服务、文创等
  • 项目经理把关选题与事实准确性
  • 工程师与设计师联合撰写专业细节
  • 统一编辑规范,保证文风与排版一致
  • 每月复盘转化数据,迭代选题方向

延伸阅读

相关资讯与近期热门内容

深度阅读推荐

建站决策前值得细读的三篇

网站改版的5个关键决策
2024-08-12

网站改版的5个关键决策

什么时候该改版、改到什么程度、如何避免流量掉光,京华建材集团改版复盘给出答案。

获取专属建站方案

看完文章,把您的行业与预算告诉我们,免费获取一份量身定制的官网建设方案与报价。

立即免费咨询