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

@longspace/cmder

v1.0.3

Published

跨平台命令行提示工具 - 通过语义化输入唤起预设命令

Readme

cmder

跨平台命令行提示工具,通过语义化关键词搜索预设命令模板,选中后直接填入终端输入行,编辑后回车执行。

依赖 Node.js(>=14)。

安装

npm install -g cmder
cmder init --install     # 一键配置 Shell 集成,重启终端后生效

使用

cmder 端口               # 搜索端口相关命令
cmder git log            # Git 日志相关
cmder docker             # Docker 相关命令
cmder                    # 列出所有可用命令
cmder -l git             # 列出命令及模板
cmder -h                 # 帮助

交互流程

  1. cmder <关键词> → 列出匹配命令,↑↓ 选择,Enter 确认,q/Esc 退出
  2. 命令模板填入终端输入行(带 {{变量}} 占位符)
  3. 修改占位符为实际值,回车执行

两种模式

| 模式 | 安装 | 效果 | |------|------|------| | 普通模式 | npm install -g cmder | 命令输出到终端 | | 增强模式 | cmder init --install | 命令直接填入输入行,编辑即执行 |

Shell 集成

cmder init --install 会自动检测当前 Shell 并配置。

手动配置:

| Shell | 配置 | |-------|------| | PowerShell | . "path/to/shell/cmder.ps1" 加到 $PROFILE | | Zsh | source "path/to/shell/cmder.zsh" 加到 ~/.zshrc | | Bash | source "path/to/shell/cmder.sh" 加到 ~/.bashrc | | Fish | source "path/to/shell/cmder.fish" 加到 ~/.config/fish/config.fish | cmder -l # 列出所有命令及命令模板

查看帮助

cmder -h


### 交互流程

1. 输入 `cmder <关键词>` 搜索命令
2. 用 `↑` `↓` 箭头键选择,`Enter` 确认,`q` / `Esc` 退出
3. 命令模板填入终端输入行(带 `{{变量}}` 占位符)

## 自定义命令库

默认命令库为项目根目录的 `commands.json`。你也可以在以下位置创建自己的命令库(优先级从高到低):

1. `./commands.json` — 当前工作目录
2. `~/.cmder/commands.json` — 用户目录
3. `<cmder>/commands.json` — 默认命令库

### 命令格式

```json
{
  "commands": [
    {
      "name": "查看端口占用",
      "keywords": ["端口", "port", "netstat", "占用"],
      "command": "netstat -ano | findstr '{{port}}'",
      "description": "查看Windows上指定端口的占用情况",
      "platform": ["windows"],
      "variables": {
        "port": { "description": "端口号", "default": "8080" }
      }
    }
  ]
}

| 字段 | 必填 | 说明 | |------|------|------| | name | 是 | 命令显示名称 | | keywords | 是 | 搜索关键词,输入任意关键词即可匹配 | | command | 是 | 命令模板,{{变量名}} 为占位符 | | description | 否 | 命令描述,显示在选择列表中 | | platform | 否 | 适用平台:windows/macos/linux/all,不填则全平台 | | variables | 否 | 变量定义,description 为提示文字,default 为默认值 |

项目结构

cmder/
├── bin/cmder.js          # CLI 入口
├── lib/
│   ├── cli.js            # 主逻辑
│   ├── search.js         # 搜索匹配
│   └── picker.js         # 交互式选择器
├── commands.json          # 默认命令数据库
├── shell/                 # Shell 集成脚本
│   ├── cmder.ps1
│   ├── cmder.sh
│   ├── cmder.zsh
│   └── cmder.fish
└── package.json