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

luotengchao-cli

v1.1.2

Published

一个简单的命令

Readme

MECLI - 多功能命令行工具集

一个包含JWT生成器和数据格式转换工具的命令行工具集。

功能特性

🔐 JWT生成器

  • 生成JWT令牌
  • 验证JWT令牌
  • 美化输出
  • 自定义配置选项
  • 支持JSON和字符串载荷

📊 数据格式转换器

  • JSON ↔ CSV 互相转换
  • JSON ↔ Excel 互相转换
  • CSV ↔ Excel 互相转换
  • Excel文件支持密码加密
  • 支持自定义分隔符
  • 支持指定工作表

🔐 SSH自动登录工具

  • 自动SSH登录到远程服务器
  • 支持配置文件管理
  • 支持sshpass和expect两种登录方式
  • 安全的密码存储

安装

  1. 克隆或下载项目
  2. 安装依赖:
npm install
  1. 全局安装(可选):
npm install -g .

使用方法

JWT生成器

基本用法

# 生成JWT令牌
node bin/jwt-gen.js generate "Hello World"

# 生成带JSON载荷的JWT
node bin/jwt-gen.js generate '{"user":"admin","role":"admin"}'

# 验证JWT令牌
node bin/jwt-gen.js verify <your-jwt-token>

高级选项

# 使用自定义密钥
node bin/jwt-gen.js generate "Hello" -s "my-secret-key"

# 设置过期时间
node bin/jwt-gen.js generate "Hello" -e "24h"

# 设置发行者和受众
node bin/jwt-gen.js generate "Hello" -i "my-app" -a "users"

# 美化输出
node bin/jwt-gen.js generate "Hello" --pretty

# 验证并美化输出
node bin/jwt-gen.js verify <token> --pretty

数据格式转换器

JSON 转 CSV

# 基本转换
data-convert json2csv -i data.json -o output.csv

# 自定义分隔符
data-convert json2csv -i data.json -o output.csv -d ";"

CSV 转 JSON

# 基本转换
data-convert csv2json -i data.csv -o output.json

# 自定义分隔符
data-convert csv2json -i data.csv -o output.json -d ";"

JSON 转 Excel(支持加密)

# 基本转换
data-convert json2excel -i data.json -o output.xlsx

# 带密码加密
data-convert json2excel -i data.json -o output.xlsx -p mypassword

# 自定义工作表名称
data-convert json2excel -i data.json -o output.xlsx -s "员工数据" -p mypassword

Excel 转 JSON(支持密码)

# 基本转换
data-convert excel2json -i data.xlsx -o output.json

# 带密码读取
data-convert excel2json -i data.xlsx -o output.json -p mypassword

# 指定工作表
data-convert excel2json -i data.xlsx -o output.json -s "Sheet2" -p mypassword

CSV 转 Excel(支持加密)

# 基本转换
data-convert csv2excel -i data.csv -o output.xlsx

# 带密码加密
data-convert csv2excel -i data.csv -o output.xlsx -p mypassword

# 自定义分隔符和密码
data-convert csv2excel -i data.csv -o output.xlsx -d ";" -p mypassword

Excel 转 CSV(支持密码)

# 基本转换
data-convert excel2csv -i data.xlsx -o output.csv

# 带密码读取
data-convert excel2csv -i data.xlsx -o output.csv -p mypassword

# 指定工作表和分隔符
data-convert excel2csv -i data.xlsx -o output.csv -s "Sheet2" -d ";" -p mypassword

命令选项

JWT生成器选项

generate 命令

  • -s, --secret <secret>: JWT密钥(默认: "your-secret-key")
  • -e, --expires <expires>: 过期时间(默认: "1h")
  • -i, --issuer <issuer>: 发行者
  • -a, --audience <audience>: 受众
  • -p, --pretty: 美化输出

verify 命令

  • -s, --secret <secret>: JWT密钥(默认: "your-secret-key")
  • -p, --pretty: 美化输出

数据转换器选项

通用选项

  • -i, --input <file>: 输入文件路径(必需)
  • -o, --output <file>: 输出文件路径(可选,默认自动生成)

CSV相关选项

  • -d, --delimiter <char>: CSV分隔符(默认: ",")

Excel相关选项

  • -s, --sheet <name>: 工作表名称
  • -p, --password <password>: Excel文件密码(加密/解密)

过期时间格式

支持以下时间格式:

  • Xs - X秒
  • Xm - X分钟
  • Xh - X小时
  • Xd - X天

例如:30s, 5m, 2h, 7d

示例

JWT生成器示例

1. 生成简单JWT

node bin/jwt-gen.js generate "Hello World"

输出:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

2. 生成带JSON载荷的JWT

node bin/jwt-gen.js generate '{"user":"admin","role":"admin"}' --pretty

输出:

✅ JWT令牌生成成功:
📝 载荷: {
  "user": "admin",
  "role": "admin"
}
🔑 密钥: your-secret-key
⏰ 过期时间: 1h
🎫 令牌:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

数据转换器示例

1. JSON 转 CSV

data-convert json2csv -i example-data.json -o employees.csv

输出:

✅ 转换完成!输出文件: employees.csv
📊 共转换 5 条记录

2. JSON 转 Excel(带加密)

data-convert json2excel -i example-data.json -o employees.xlsx -p secret123

输出:

🔒 文件将使用密码加密
✅ 转换完成!输出文件: employees.xlsx
📊 共转换 5 条记录
🔐 密码: secret123

3. Excel 转 JSON(带密码)

data-convert excel2json -i employees.xlsx -o employees.json -p secret123

SSH自动登录工具示例

1. 使用默认配置登录

ssh-login

2. 设置SSH配置

ssh-login config -h  -p 

3. 查看当前配置

ssh-login show

4. 使用保存的配置登录

ssh-login login

data-convert excel2json -i employees.xlsx -o data.json -p secret123


输出:

📋 使用工作表: Sheet1 ✅ 转换完成!输出文件: data.json 📊 共转换 5 条记录


## 安全注意事项

⚠️ **重要提醒**:

1. 在生产环境中,请使用强密钥替换默认密钥
2. 密钥应该通过环境变量或配置文件管理
3. 不要在代码中硬编码敏感信息
4. 定期轮换密钥
5. Excel密码应该妥善保管,避免泄露

## 开发

### 项目结构

mecli/ ├── bin/ │ ├── jwt-gen.js # JWT生成器 │ └── data-convert.js # 数据转换器 ├── example-data.json # 示例数据 ├── package.json # 项目配置 └── README.md # 项目说明


### 依赖包

#### JWT生成器
- `jsonwebtoken`: JWT生成和验证
- `commander`: 命令行参数解析
- `chalk`: 终端颜色输出

#### 数据转换器
- `xlsx`: Excel文件读写
- `csv-parser`: CSV文件解析
- `csv-writer`: CSV文件写入
- `fs-extra`: 文件系统操作增强
- `commander`: 命令行参数解析
- `chalk`: 终端颜色输出

## 许可证

MIT License

## 贡献

欢迎提交Issue和Pull Request!