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

dir-cli

v2.0.0

Published

🚀 Professional Project Migration Assistant - Git status check, smart cleanup, and migration preparation tools

Downloads

3

Readme

dir-cli v2.0

一个安全高效的项目清理与迁移准备工具。

✨ 功能亮点

  • 智能清理:支持 Node.js、Python、Java、Rust、Go
  • Git 准备度检查:未提交、未推送、冲突、远程仓库
  • 状态报告:支持 HTML / Markdown / JSON 输出
  • 安全机制:Dry-run 预览、白名单、路径校验、符号链接防护
  • 国际化:内置中英文,多语言可选

📦 环境要求

  • Node.js >= 16.0.0
  • 操作系统:macOS、Linux 或 Windows(含 WSL)

🚀 安装

npm install -g dir-cli

⚡ 快速开始

# 检查项目状态与迁移准备度
dir-cli check

# 预览清理(不实际删除)
dir-cli clean all --dry-run

# 生成 HTML 报告
dir-cli report migration --format html --output report.html

🧰 命令说明

dir-cli check

扫描并分析当前目录下各项目的 Git 状态与迁移准备度。

选项:

  • --depth <number>:最大扫描深度(默认:无限制)
  • --format <type>table | json | plain(默认:table
  • --include-hidden:包含隐藏目录
  • --exclude <patterns>:逗号分隔的排除模式
  • --output <file>:将 JSON 输出保存到文件
  • --no-progress:禁用进度条

示例:

  • dir-cli check
  • dir-cli check --depth 3
  • dir-cli check --format json --output status.json
  • dir-cli check --exclude "temp,cache"

dir-cli clean

智能清理依赖与构建产物。

用法:dir-cli clean [type] [options]

类型:

  • nodenode_modulesdist.next.nuxt
  • python__pycache__.pytest_cachedistbuildvenv.venv
  • javatargetbuild.gradleoutlogsdist
  • rusttarget
  • gobindistbuildcoverage.out(注意:默认不清理 vendor/
  • all:清理以上所有类型

选项:

  • --dry-run:预览将要清理的内容,不实际删除
  • --interactive:交互式选择要清理的项目
  • --yes:跳过确认提示
  • --no-progress:禁用进度条
  • --include-hidden:扫描时包含隐藏目录
  • --exclude <patterns>:逗号分隔的排除模式
  • --format <type>table | json | plain(默认:table

示例:

  • dir-cli clean
  • dir-cli clean node --dry-run
  • dir-cli clean python --yes
  • dir-cli clean all --interactive

dir-cli report

基于实时扫描结果生成迁移/状态报告。

用法:dir-cli report [type] [options]

类型:

  • status:项目状态报告
  • migration:迁移准备度报告(当前与 status 数据一致,展示角度不同)

选项:

  • --format <format>html | json | markdown(默认:html
  • --output <file>:输出文件路径

示例:

  • dir-cli report status --format html --output status.html
  • dir-cli report migration --format markdown --output migration.md
  • dir-cli report status --format json --output status.json

dir-cli config

管理配置。

用法:dir-cli config [action] [key] [value]

动作:

  • list:打印全部配置
  • get <key>:读取配置
  • set <key> <value>:设置配置(支持点号路径,如 scan.maxDepth
  • reset:重置为默认

示例:

  • dir-cli config list
  • dir-cli config get scan.maxDepth
  • dir-cli config set scan.maxDepth 5
  • dir-cli config set clean.defaultSelectAll false
  • dir-cli config reset

dir-cli locale

语言设置。

用法:

  • dir-cli locale --current
  • dir-cli locale --list
  • dir-cli locale <locale>(如 enzh-CN

🔧 支持的项目类型

| 类型 | 识别方式 | 清理目标 | 说明 | |------|----------|----------|------| | Node.js | package.json | node_modulesdist.next.nuxt | 支持 npm/yarn/pnpm/bun | | Python | requirements.txtsetup.pypyproject.tomlPipfile | __pycache__.pytest_cachedistbuildvenv.venv | | | Java | pom.xmlbuild.gradle(.kts) | targetbuild.gradleoutlogsdist | Maven/Gradle | | Rust | Cargo.toml | target | Cargo 构建产物 | | Go | go.mod | bindistbuildcoverage.out | 默认不清理 vendor/ |

🛡️ 安全机制

  • 白名单:仅删除白名单内路径(如 node_modulestarget.gradlebin 等)
  • 路径校验:防止越界删除,仅在项目根内操作
  • 符号链接:跳过符号链接
  • Dry-run:先预览再执行,避免误删
  • 故障隔离:个别项目失败不影响其他项目
  • 安全日志:控制台输出,可扩展到文件

⚙️ 配置(摘录)

{
  "scan": {
    "maxDepth": "unlimited",
    "excludeDirs": [".git", ".cache", ".tmp", "temp", ".DS_Store", "Thumbs.db"],
    "includeHidden": false,
    "concurrent": 10,
    "ignoreSymlinks": true
  },
  "git": {
    "checkUncommitted": true,
    "checkUnpushed": true,
    "checkRemote": true,
    "checkConflicts": true,
    "defaultBranch": "main",
    "ignoreFiles": [".DS_Store", "Thumbs.db", "*.log"]
  },
  "clean": {
    "defaultSelectAll": true,
    "showPreview": true,
    "logOperations": true,
    "logPath": "~/.dir-cli/logs",
    "enabledCleaners": ["node", "python", "java", "rust", "go"]
  },
  "output": {
    "format": "table",
    "showProgress": true,
    "colorful": true,
    "verbose": false,
    "locale": "auto"
  }
}

通过 dir-cli config 管理配置。

🔍 使用示例

  • 迁移准备

    • dir-cli check --format json --output migration-status.json
    • dir-cli clean all --dry-run
    • dir-cli clean all --yes
    • dir-cli report migration --format html --output migration-report.html
  • 磁盘清理

    • dir-cli clean node --dry-run
    • dir-cli clean python --interactive
  • CI 集成

    • dir-cli check --format json > status.json
    • dir-cli report status --format markdown --output status.md

🌍 国际化

内置:enzh-CNzh-TWjakoesfrderu。 使用 dir-cli locale 管理语言。

❗ 故障排查

  • Windows/WSL:建议在项目所在的同一文件系统中运行
  • 权限:确保对清理目标具有写权限
  • 建议:先用 --dry-run 预览再执行

📄 许可证

MIT