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

ai-rename

v1.1.3

Published

智能文件名批量修改工具 - 使用自然语言提示词重命名文件和文件夹

Readme

AI-Rename - 智能文件名批量修改工具

一个基于 AI 的命令行工具,使用自然语言提示词批量重命名文件和文件夹。通过 DeepSeek 大模型理解您的重命名需求,自动生成正则表达式并执行重命名操作。

✨ 特性

  • 🤖 AI 驱动 - 使用 DeepSeek 大模型理解自然语言提示词
  • 🔄 批量重命名 - 深度遍历目录,同时支持文件和文件夹重命名
  • 📁 智能排序 - 自动按深度排序,先处理深层再处理浅层,避免路径错误
  • 🎯 正则表达式 - 自动生成精确的搜索和替换模式
  • ⚙️ 配置管理 - 安全存储和管理 DeepSeek API Key
  • 🎨 友好界面 - 彩色输出,交互式确认,实时进度提示

📦 安装

全局安装

npm install -g ai-rename

本地开发

# 克隆项目
git clone <repository-url>
cd ai-rename

# 安装依赖
npm install

# 链接到全局(用于开发测试)
npm link

🚀 使用方法

1. 配置 API Key

首次使用前,需要配置 DeepSeek API Key:

ai-rename config

系统会提示您输入 API Key。如果您还没有 API Key,请访问 DeepSeek 官网 注册并获取。

2. 重命名文件

方式一:直接提供提示词

ai-rename rename "把所有文件名中的2022改为2023"

方式二:交互式输入

ai-rename rename

系统会提示您输入重命名描述。

指定目录

ai-rename rename "删除文件名中的下划线" -d ./my-folder

📝 使用示例

示例 1:替换年份

ai-rename rename "把所有文件名中的2022改为2023"
  • report-2022.pdfreport-2023.pdf
  • data-2022-01.xlsxdata-2023-01.xlsx

示例 2:修改分隔符

ai-rename rename "把文件名中的下划线改为连字符"
  • my_file_name.txtmy-file-name.txt
  • data_export_2023.csvdata-export-2023.csv

示例 3:删除前缀

ai-rename rename "删除文件名开头的数字和横杠"
  • 001-document.pdfdocument.pdf
  • 123-photo.jpgphoto.jpg

示例 4:批量添加前缀

ai-rename rename "给所有文件名添加前缀 backup_"
  • file1.txtbackup_file1.txt
  • data.csvbackup_data.csv

示例 5:统一大小写

ai-rename rename "把文件名改为小写"
  • MyFile.TXTmyfile.TXT (注意:只改文件名,不改扩展名)

示例 6:重命名文件夹

ai-rename rename "把文件夹名中的2022改为2023"

效果:

  • 文件夹:folder-2022-oldfolder-2023-old
  • 文件夹:project-2022project-2023
  • 文件:report-2022.pdfreport-2023.pdf

示例 7:删除文件夹前缀

ai-rename rename "删除开头的 backup_"

效果:

  • 文件夹:backup_documentsdocuments
  • 文件夹:backup_photosphotos
  • 文件:backup_data.csvdata.csv

🔧 命令详解

config - 配置 API Key

ai-rename config

配置或更新 DeepSeek API Key。

rename - 重命名文件和文件夹

ai-rename rename [提示词] [选项]

参数:

  • 提示词 - 可选,描述如何修改文件名或文件夹名的自然语言文本

选项:

  • -d, --dir <directory> - 指定目标目录(默认为当前目录)

⚠️ 注意事项

  1. 备份重要文件 - 重命名操作不可逆,建议先在测试目录中验证效果
  2. 排除目录 - 工具会自动排除 node_modules.git.vscode.idea 等系统目录
  3. 文件名冲突 - 如果目标文件名或文件夹名已存在,将跳过并显示警告
  4. 智能排序 - 文件夹重命名时,自动从深层到浅层处理,避免路径错误
  5. 确认操作 - 执行前会显示搜索和替换模式,并要求确认

🛠️ 技术栈

  • Node.js - 运行环境
  • Commander.js - 命令行参数解析
  • Inquirer.js - 交互式命令行界面
  • Chalk - 终端文本着色
  • Axios - HTTP 客户端(调用 DeepSeek API)
  • Configstore - 配置管理
  • Ora - 终端加载动画

🤝 贡献

欢迎提交 Issue 和 Pull Request!

📄 许可证

ISC

🔗 相关链接

💡 提示

如果您在使用过程中遇到问题,请确保:

  1. ✅ 已正确配置 DeepSeek API Key
  2. ✅ API Key 有足够的配额
  3. ✅ 网络连接正常
  4. ✅ 有文件系统的读写权限

Made with ❤️ by [Your Name]