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

nezha-writer

v1.0.1

Published

✍️ 哪吒写作助手 - AI内容生成CLI工具 / AI Content Writing CLI

Downloads

235

Readme

✍️ 哪吒写作助手 (nezha-writer)

AI 驱动的命令行内容生成工具 — 基于 DeepSeek API

AI-powered CLI content generation tool powered by DeepSeek API

npm version License: MIT Node.js Version


📦 安装

全局安装(推荐)

npm install -g nezha-writer

本地安装

git clone https://github.com/Nezha-Agent/nezha-writer.git
cd nezha-writer
npm install
npm link    # 将命令链接到全局

🚀 快速上手

1. 设置 API Key

# 方式一:环境变量
export DEEPSEEK_API_KEY=sk-your-api-key-here

# 方式二:创建 .env 文件(复制 .env.example 并填写)
cp .env.example .env
# 然后在 .env 中填写你的 DEEPSEEK_API_KEY

2. 查看帮助

nezha-writer --help

📖 命令参考

seo <keyword> — 生成 SEO 文章

围绕目标关键词生成搜索引擎友好的优化文章。

# 基本用法
nezha-writer seo "Node.js 入门教程"

# 指定字数和输出文件
nezha-writer seo "AI 写作工具" --length 2000 --output ./articles/seo-ai-writing.md

# 英文输出
nezha-writer seo "machine learning basics" --lang en

| 选项 | 说明 | 默认值 | |------|------|--------| | -l, --length <words> | 文章字数 | 1000 | | -o, --output <path> | 输出文件路径 | 自动生成 | | -L, --lang <lang> | 输出语言 (zh/en) | zh |


xhs <topic> — 生成小红书文案

生成适合小红书平台的种草/测评/教程/情感文案。

# 基本用法(默认种草风格)
nezha-writer xhs "夏日防晒推荐"

# 指定风格
nezha-writer xhs "iPhone 16 评测" --style 测评

# 指定输出文件
nezha-writer xhs "零基础学Python" --style 教程 --output ./xhs/python-tutorial.md

| 选项 | 说明 | 默认值 | |------|------|--------| | -s, --style <style> | 文案风格 (种草/测评/教程/情感) | 种草 | | -o, --output <path> | 输出文件路径 | 自动生成 | | -L, --lang <lang> | 输出语言 | zh |


translate <text> — 翻译文本

使用 AI 进行高质量翻译,保留原文格式和风格。

# 翻译成中文(自动检测源语言)
nezha-writer translate "Hello, how are you?"

# 指定目标语言
nezha-writer translate "Bonjour le monde" --to 中文

# 指定源语言和目标语言
nezha-writer translate "I love programming" --from English --to 法语

# 保存到文件
nezha-writer translate "长文本内容..." --output ./translate/result.md

| 选项 | 说明 | 默认值 | |------|------|--------| | -f, --from <lang> | 源语言 | 自动检测 | | -t, --to <lang> | 目标语言 | 中文 | | -o, --output <path> | 输出文件路径 | 自动生成 |


batch <file> — 批量处理

从 JSON 配置文件读取多个任务并批量处理。

nezha-writer batch ./tasks.json

任务 JSON 格式示例 (tasks.json):

{
  "tasks": [
    {
      "type": "seo",
      "keyword": "如何学好英语",
      "length": 800,
      "lang": "zh"
    },
    {
      "type": "xhs",
      "topic": "冬季护肤好物",
      "style": "种草",
      "lang": "zh"
    },
    {
      "type": "translate",
      "text": "Life is what happens when you're busy making other plans.",
      "to": "中文"
    }
  ]
}

| 选项 | 说明 | 默认值 | |------|------|--------| | -o, --output-dir <dir> | 输出目录 | ./output |


📂 输出结构

默认输出目录为 ./output/,所有生成的文件均为 Markdown 格式(.md):

output/
├── seo_Node.js入门教程_1712345678901.md
├── xhs_夏日防晒推荐_1712345678902.md
├── translate_中文_1712345678903.md
└── ...

⚙️ 环境变量

| 变量 | 说明 | 默认值 | 必填 | |------|------|--------|------| | DEEPSEEK_API_KEY | DeepSeek API Key | — | ✅ 是 | | DEEPSEEK_API_BASE | 自定义 API 地址 | https://api.deepseek.com/v1 | ❌ | | OUTPUT_DIR | 默认输出目录 | ./output | ❌ |


🛠️ 开发

# 安装依赖
npm install

# 本地运行(开发模式)
node bin/cli.js seo "测试关键词"

# 链接到全局
npm link
nezha-writer --version

项目结构

nezha-writer/
├── bin/
│   └── cli.js              # CLI 入口
├── src/
│   ├── utils.js            # 共享工具(API调用、文件输出、UI辅助)
│   ├── command-seo.js      # SEO 文章生成命令
│   ├── command-xhs.js      # 小红书文案生成命令
│   ├── command-translate.js # 翻译命令
│   └── command-batch.js    # 批量处理命令
├── .env.example            # 环境变量模板
├── package.json
└── README.md

🧪 示例

实战:生成一篇 SEO 文章并查看

export DEEPSEEK_API_KEY=sk-xxx
nezha-writer seo "TypeScript 入门指南" --length 1500
cat output/seo_TypeScript入门指南_*.md

实战:批量生成内容

# 创建任务文件
cat > tasks.json << 'EOF'
{
  "tasks": [
    { "type": "seo", "keyword": "React vs Vue", "length": 1200 },
    { "type": "xhs", "topic": "程序员桌面好物", "style": "种草" }
  ]
}
EOF

# 执行批量处理
nezha-writer batch tasks.json

📋 依赖

| 包 | 版本 | 用途 | |----|------|------| | commander | ^11.0.0 | CLI 框架 | | chalk | ^4.1.2 | 终端彩色输出 | | ora | ^5.4.1 | 加载动画 | | dotenv | ^16.0.3 | 环境变量加载 |


🔗 相关项目


📄 许可证

MIT © 2024 Nezha-Agent