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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@pengzi/zlink

v1.1.1

Published

Mac shell 别名管理工具 - 轻松管理你的 zsh 别名

Readme

zlink Manager - Mac 别名管理工具 🚀

一个简单易用的命令行工具,用于管理 Mac 上的 zsh shell 别名。

✨ 功能特点

  • 📋 查看别名: 列出所有已配置的别名(含描述说明)
  • 添加别名: 快速添加新的别名(支持添加命令说明)
  • ✏️ 编辑别名: 修改现有别名的名称、命令或说明
  • 🗑️ 删除别名: 批量删除不需要的别名
  • 🔍 搜索别名: 根据关键词快速查找别名(支持搜索描述)
  • 🚀 执行别名: 交互式单选框,两种执行模式(新终端/复制命令)
  • 🔄 自动生效: 每次修改后自动 source ~/.zshrc
  • 🔧 独立管理: 不影响其他手动配置的别名

📦 安装

方式一: 全局安装 (推荐)

npm install -g @pengzi/zlink

安装后可以在任何地方使用 zlink 命令。

方式二: 本地开发

# 克隆项目
git clone <https://github.com/pzdemos/zlink>
cd zlink

# 链接到全局
npm link

# 运行
zlink

🎯 使用方法

启动工具

zlink

主菜单

╔════════════════════════════════════╗
║     Mac 别名管理工具 v1.1.1       ║
╚════════════════════════════════════╝

请选择操作:
  1. 📋 查看所有别名
  2. ➕ 添加新别名
  3. ✏️  编辑别名
  4. 🗑️  删除别名
  5. 🔍 搜索别名
  6. 🚀 执行别名命令
  0. 👋 退出

📝 使用示例

添加 SSH 别名

请选择操作: 2
请输入别名名称: bt
请输入命令内容: ssh [email protected]
请输入命令说明 (可选): 连接到生产服务器

✅ 已添加别名: bt = 'ssh [email protected]'
   说明: 连接到生产服务器
✅ 已重新加载 ~/.zshrc

现在你可以直接使用 bt 命令快速 SSH 登录!

添加常用命令别名

# Git 相关
gs -> git status
gp -> git push
gc -> git commit -m

# 目录跳转
www -> cd /var/www
proj -> cd ~/Projects

# 系统命令
ll -> ls -lah
update -> brew update && brew upgrade

编辑现有别名

请选择操作: 3

📝 可编辑的别名:
[1] bt = 'ssh [email protected]'
[2] gs = 'git status'

请选择要编辑的别名序号: 1
当前别名: bt = 'ssh [email protected]'
新的别名名称 (留空保持 'bt'): 
新的命令内容 (留空保持当前命令): ssh [email protected]

✅ 已更新别名: bt = 'ssh [email protected]'

删除别名

请选择操作: 4

🗑️  可删除的别名:
[1] test1 = 'echo test1'
[2] test2 = 'echo test2'
[3] test3 = 'echo test3'

请选择要删除的别名序号 (多个用逗号分隔): 1,3

将删除以下别名:
  - test1
  - test3

确认删除? (y/n): y

✅ 删除成功

搜索别名

请选择操作: 5
🔍 请输入搜索关键词: git

🔍 搜索结果 (共 3 条):
🔧 [1] gs = 'git status' - 查看 Git 仓库状态
🔧 [2] gp = 'git push' - 推送代码到远程
🔧 [3] gc = 'git commit -m' - 提交代码

执行别名命令

请选择操作: 6

🚀 选择要执行的命令:

  ▶ 🔧 deploy - 构建并部署项目到服务器
    🔧 bt - 连接到生产服务器
    📌 gs - 查看 Git 仓库状态
    ❌ 取消

使用 ↑↓ 方向键选择,Enter 确认,ESC/Ctrl+C 取消

[用户按下 Enter 选择 deploy]

准备执行: deploy
命令内容: npm run build && rsync -av dist/ server:/var/www/
命令说明: 构建并部署项目到服务器

请选择执行方式:

  ▶ 🆕 在新终端窗口中执行
    📋 复制命令到剪贴板
    ❌ 取消

使用 ↑↓ 方向键选择,Enter 确认,ESC/Ctrl+C 取消

[用户按下 Enter 选择默认]

✅ 已在新终端窗口中执行命令

🔒 安全特性

  • ✅ 别名集中管理在标记区域内,不会影响其他配置
  • ✅ 删除操作需要二次确认
  • ✅ 覆盖已存在别名时会提示确认
  • ✅ 自动备份机制(通过标记管理)

📂 文件结构

zlink/
├── index.js          # 主程序
├── package.json      # 包配置
└── README.md         # 说明文档

🎮 交互式界面

单选框操作

  • 方向键控制: 使用 ↑↓ 方向键在选项间移动
  • Enter 确认: 按 Enter 键确认当前选择
  • ESC 取消: 按 ESC 或 Ctrl+C 取消操作
  • 默认选项: 第一个选项默认被选中
  • 彩色显示: 不同类型信息用不同颜色区分

颜色含义

  • 🔷 蓝色: 序号和提示信息
  • 🟢 绿色: 成功消息和当前选中项
  • 🟡 黄色: 命令内容
  • 🔵 青色: 别名名称
  • 灰色: 描述说明
  • 🔴 红色: 错误信息
  • 🟣 紫色: 标签说明

🚀 执行模式说明

工具提供两种执行别名的方式:

  1. 在新终端窗口中执行 - 默认选项,自动打开新的终端窗口(支持 Terminal.app 和 iTerm2)
  2. 复制命令到剪贴板 - 将命令复制到剪贴板,手动粘贴执行

🔧 配置文件位置

工具会在 ~/.zshrc 文件中创建一个管理区域:

# === Managed Aliases Start ===
# DESC: 连接到生产服务器
alias bt='ssh [email protected]'
# DESC: 查看 Git 仓库状态
alias gs='git status'
# DESC: 构建并部署项目
alias deploy='npm run build && rsync -av dist/ server:/var/www/'
# === Managed Aliases End ===

这个区域由工具自动管理,建议不要手动编辑。

🎨 图标说明

  • 🔧 = 本工具管理的别名
  • 📌 = 其他方式配置的别名
  • 🚀 = 执行命令相关功能
  • 📋 = 查看/复制功能

⚙️ 系统要求

  • macOS (支持 zsh)
  • Node.js >= 14.0.0
  • 已安装并配置 zsh 作为默认 shell

🤝 贡献

欢迎提交 Issue 和 Pull Request!

📄 许可证

MIT License

💡 常见问题

Q: 工具会影响我手动配置的别名吗?

A: 不会。工具只管理标记区域内的别名,不会影响其他配置。

Q: 如何卸载?

A: 运行 npm uninstall -g @pengzi/zlink,然后手动从 ~/.zshrc 中删除管理区域。

Q: 支持 bash 吗?

A: 当前版本仅支持 zsh,后续版本会考虑支持 bash。

Q: 如何备份我的别名?

A: 别名存储在 ~/.zshrc 中,建议定期备份该文件。


Made with zhaojiu for Mac developers