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

repodex

v0.2.5

Published

Codemap for AI — tree-sitter powered code signature extraction and call graph

Readme

repodex

用 1% 的 token 把整个代码库喂给 AI。

一条命令,把压缩后的代码地图(技术栈、文件树、签名、调用图)注入到 CLAUDE.md

AI 看到的内容

# Overview

package.json:
  stack: react, vite, ts, tailwind
  scripts: dev, build, test
tsconfig.json: target: ES2020, paths: { "@/*": "./src/*" }
vite.config.ts: plugins: @vitejs/plugin-react

# File Tree

├── src/
│   ├── auth/
│   │   ├── login.ts
│   │   └── session.ts
│   ├── components/
│   │   ├── Button.tsx
│   │   └── Dialog.tsx
│   └── fixtures/
│       └── .json ×29                ← 大目录按扩展名折叠

# Signatures

<file path="src/auth/login.ts">
export async function login(email: string, password: string): Promise<Session>
export async function logout(sessionId: string): Promise<void>
</file>

AI 不再需要「先让我了解一下项目结构」,直接开干。

安装

npm i -D repodex       # npm
pnpm add -D repodex    # pnpm
bun add -D repodex     # bun
npx repodex            # 扫描、压缩、注入到 CLAUDE.md

首次运行会启动初始化向导:自动检测已有的 AI 上下文文件(CLAUDE.mdAGENTS.md.cursorrules 等),可选安装 git pre-commit hook,并生成 repodex.config.ts

配置

// repodex.config.ts
import { defineConfig } from 'repodex'

export default defineConfig({
    // 扫描哪些文件(根目录配置文件如 package.json 始终包含)
    include: [
        'src/**',
    ],
    // 排除的文件
    ignore: [],
    // 每个文件的详细程度:'tree' = 仅文件名,'compact' = 签名,'full' = 源码
    fileDetailLevel: {
        // 'src/components/ui/**': 'tree',
    },
    // 注入到 CLAUDE.md 的详细程度
    injectDetailLevel: 'compact',
    // 注入目标文件
    injectTargetFiles: ['CLAUDE.md', 'AGENTS.md'],
    // 注入调用图命令说明(context/impact/changes)
    injectCallGraphInstructions: true,
    // Token 预算 — 超出时自动降级低优先级文件
    maxTokens: 10_000,
})

智能分配

设置 maxTokens 后,repodex 会对每个文件按 git 修改时间import 中心度 打分,然后自动降级低信号文件(compacttree → 丢弃)以适配预算。高频修改、被大量引用的文件保留完整签名。

调用图

子命令每次运行时实时构建调用图,始终反映最新代码:

npx repodex context <symbol>   # 谁调用了它?它调用了谁?
npx repodex impact  <symbol>   # 改了它会影响什么?(BFS 风险评级)
npx repodex changes            # 当前 git diff 涉及哪些符号?

均支持 --json 输出结构化数据。这些命令会自动注入到 CLAUDE.md,AI 在修改代码前会自动使用。

监听模式

npx repodex --watch    # 文件变动时自动重新生成

Git Hook

npx repodex hooks      # 安装 pre-commit hook 到 .repodex/hooks/

package.json 中添加以下脚本,安装依赖时自动绑定:

{ "scripts": { "prepare": "repodex hooks" } }

License

MIT