npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

umi-plugin-repomix

v1.0.0

Published

Umijs plugin for repomix - automatically generates llms.txt and llms-full.txt

Readme

umi-plugin-repomix

npm version npm downloads CI Publish to NPM

UmiJS 插件,用于自动生成 llms.txt 和 llms-full.txt 文件,方便 AI 辅助工具更好地理解项目代码结构。

功能特性

  • 🚀 自动生成 llms.txt 和 llms-full.txt 文件
  • 🔧 支持自定义 repomix 配置
  • 📦 支持 UmiJS 项目和 Dumi 组件库
  • ⚙️ 灵活的构建时机配置
  • 🎯 零配置即可使用

安装

npm install umi-plugin-repomix --save-dev
# or
yarn add umi-plugin-repomix -D
# or
pnpm add umi-plugin-repomix -D

使用

基础使用

在 .umirc.ts 或 config/config.ts 中启用插件:

export default {
  plugins: ['umi-plugin-repomix'],
  // 安装后默认启用,无需额外配置
};

禁用插件

export default {
  plugins: ['umi-plugin-repomix'],
  repomix: false, // 禁用插件
};

配置选项

所有配置选项都是标准的 Repomix 配置,直接在 repomix 字段中设置:

export default {
  plugins: ['umi-plugin-repomix'],
  repomix: {
    output: {
      style: 'markdown', // 输出格式,默认为 markdown
      removeComments: false,
      showLineNumbers: true,
    },
    ignore: {
      useGitignore: true,
      useDefaultPatterns: true,
      customPatterns: ['**/*.test.ts', '**/*.spec.ts'],
    },
    security: {
      enableSecurityCheck: true,
    },
  },
};

配置示例

自定义忽略模式

export default {
  plugins: ['umi-plugin-repomix'],
  repomix: {
    ignore: {
      useGitignore: true,
      useDefaultPatterns: true,
      customPatterns: ['**/*.test.ts', '**/*.spec.ts', '**/.umi/**'],
    },
  },
};

自定义输出格式

export default {
  plugins: ['umi-plugin-repomix'],
  repomix: {
    output: {
      style: 'xml', // 可选: 'plain', 'xml', 'markdown', 'json'
      removeComments: true,
      showLineNumbers: false,
    },
  },
};

Repomix 配置

插件使用 Repomix SDK,所有配置都通过 UmiJS 配置的 repomix.config 选项传递。关于 repomix 的详细配置,请参考 Repomix 官方文档。

常用配置选项:

  • output.style: 输出格式(plain、xml、markdown、json)
  • output.removeComments: 是否移除注释
  • output.showLineNumbers: 是否显示行号
  • output.fileSummary: 是否包含文件摘要
  • output.directoryStructure: 是否包含目录结构
  • ignore.useGitignore: 是否使用 .gitignore
  • ignore.useDefaultPatterns: 是否使用默认忽略模式
  • ignore.customPatterns: 自定义忽略的文件模式
  • security.enableSecurityCheck: 是否启用安全检查

工作原理

  1. 插件在 UmiJS 构建流程中注册 onBuildComplete 钩子
  2. 在构建完成后使用 Repomix SDK 的 pack 函数
  3. 生成两个文件:
    • llms.txt:轻量版本,仅包含文件列表(files: false)
    • llms-full.txt:完整版本,包含所有文件内容和默认配置
  4. 文件输出到 UmiJS 配置的输出目录(通常是 dist)
  5. 默认使用 markdown 格式输出

常见问题

Q: 为什么需要生成 llms.txt?

A: llms.txt 是一个标准格式,用于帮助 AI 工具(如 GitHub Copilot、ChatGPT 等)更好地理解项目的代码结构和内容,从而提供更准确的代码建议。

Q: llms.txt 和 llms-full.txt 有什么区别?

A: llms.txt 是轻量版本,仅包含文件列表和基本信息,不包含文件内容;llms-full.txt 是完整版本,包含所有文件的完整内容。

Q: 可以在开发模式下使用吗?

A: 插件在 onBuildComplete 钩子中执行,主要用于生产构建。开发模式下不会自动生成文件。

相关链接

开发与发布

本地开发

# 克隆仓库
git clone https://github.com/jeasonstudio/umi-plugin-repomix.git
cd umi-plugin-repomix

# 安装依赖
npm install

# 开发模式(监听文件变化)
npm run dev

# 构建
npm run build

发布新版本

  1. 更新版本号:

    npm version patch  # 或 minor、major
  2. 在 GitHub 上创建新的 Release,GitHub Actions 会自动发布到 NPM

详细说明请参考 .github/workflows/README.md

License

MIT