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-refactor-deepseek-cli

v1.1.0

Published

`deepseek-refactor` 是一个命令行工具,基于 [DeepSeek Coder](https://deepseek.com/) 的 AI 能力,自动对你的前端/后端代码进行重构、解耦和注释,并可选择自动拆分模块。

Downloads

4

Readme

🤖 DeepSeek Refactor CLI

deepseek-refactor 是一个命令行工具,基于 DeepSeek Coder 的 AI 能力,自动对你的前端/后端代码进行重构、解耦和注释,并可选择自动拆分模块。


✨ 功能特点

  • 自动调用 DeepSeek API 重构 .js, .ts, .jsx, .tsx, .vue 文件
  • 支持单个文件或整个目录递归处理
  • 支持 Markdown 输出建议
  • 可选开启模块自动拆分(适合大文件组件化)

📦 安装依赖

确保你已安装 Node.js(建议 16+):

npm install

需要依赖:

  • chalk
  • commander
  • dotenv
  • fs-extra
  • node-fetch

🔐 设置 API Key

在项目根目录下创建 .env 文件:

DEEPSEEK_API_KEY=your_deepseek_api_key_here

也可以通过系统环境变量设置 DEEPSEEK_API_KEY


🚀 使用方式(CLI)

📌 基本命令

npx deepseek-refactor <input> [options]

🧾 参数说明

| 参数 | 类型 | 默认值 | 说明 | |------|------|--------|------| | <input> | string | - | 必填,输入的文件或文件夹路径 | | -o, --output | string | refactored | 输出目录(可选) | | --split | boolean | false | 是否启用自动模块拆分(适合大文件) |


✅ 示例用法

1. 对整个项目目录进行重构

npx deepseek-refactor ./src

2. 指定输出目录

npx deepseek-refactor ./src -o ./out

3. 启用模块拆分(推荐用于大型组件)

npx deepseek-refactor ./src --split

4. 重构单个文件

npx deepseek-refactor ./src/App.vue

📁 输出结构

  • 对于每个处理的文件,会生成一个 .md Markdown 文件,内容为 AI 的重构建议;
  • 如果开启了 --split,超过 80 行的文件会被拆分为多个模块,写入 refined/ 子目录中。
src/
├── App.vue
├── App.vue.md               # ✅ AI Markdown 重构建议
├── refined/
│   ├── refined__App.vue_0.js
│   └── refined__App.vue_1.js

⚠️ 注意事项

  • 必须设置 DEEPSEEK_API_KEY,否则无法调用 API;
  • 深度拆分仅对大于 80 行的文件生效;
  • 当前不会修改原始文件,仅生成建议和拆分后的模块;
  • DeepSeek API 可能限制速率,请避免频繁大批量请求;

📄 License

MIT License.


🙋‍♀️ 联系与反馈

如需新功能、支持更多语言或集成到 CI/CD、VS Code 插件等,欢迎提 Issue!


---

如果你希望将该 CLI 工具发布为 npm 包(支持 `npx deepseek-refactor`),我也可以帮你写一个完整的 `package.json` 和发布流程 ✅