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

@waterpack/mr-cli

v1.0.16

Published

远程操作 GitLab Merge Request 命令行工具.

Readme

mr-cli

mr-cli 是一个 GitLab Merge Request 命令行工具,能够帮助我们在命令行中交互式创建 Merge Reqeust,使 Code Review 流程更简洁高效。

如何使用?

1. 全局安装

npm install @waterpack/mr-cli -g

2. 配置 GitLab token

mr token <你的token>

3. 运行脚本,部分命令示例

# 创建 MR
mr

# 设置 token
mr token <token>

# 查看 token
mr token

# 查看用户
mr user get --id=xxx

# 查看所有用户
mr user list

# 查看项目
mr dtu get xxx

# 查看所有项目
mr dtu list

# 查看帮助信息
mr -h

# mr user 子命令帮助信息
mr user -h

# mr dtu 子命令帮助信息
mr dtu -h

获取帮助菜单

$ mr -h

使用: mr [命令] <选项>

命令:
  mr token [token]  查看/设置GitLab Token
  mr user <命令>    操作用户数据
  mr dtu <命令>     操作GitLab项目与钉钉机器人URL的映射数据(DingTalkUrl)

选项:
  -v, --version  显示版本号                                               [布尔]
  -h, --help     显示帮助信息                                             [布尔]

示例:
  $ mr               创建MR
  $ mr token         获取token
  $ mr token 123456  设置token为123456
  $ mr -h            显示帮助信息
  $ mr user -h       显示user子命令帮助信息
  $ mr dtu -h        显示dtu子命令帮助信息

mr user 操作用户数据

mr user 子命令用于操作服务端的用户数据,包括增、删、改、查等。

服务端的用户数据主要用于建立GitLab用户钉钉用户的映射关系,实现将GitLab上用户的操作推送消息到钉钉群对应的人

mr user 命令帮助菜单:

$ mr user -h

mr user <命令>

操作用户数据

命令:
  mr user get [--选项]                                     查看用户,根据 id | username | mobile 查询
  mr user list                                             查看全部用户
  mr user set <id> <name> <username> <mobile>              设置用户,参数解释: <GitLab用户ID> <你的名字> <GitLab username> <手机号>
  mr user update <old_id> <id> <name> <username> <mobile>  更新用户,参数解释: <GitLab用户ID> <新的GitLab用户ID> <你的名字> <GitLab username> <手机号>
  mr user delete <id>                                      删除用户,参数解释: <GitLab用户ID>

mr dtu 操作GitLab项目与钉钉机器人URL的映射数据

mr dtu 子命令用于操作服务端的GitLab项目与钉钉机器人URL的映射数据,包括增、删、改、查等。

服务端的GitLab项目与钉钉机器人URL的映射数据主要用于建立GitLab项目钉钉群自定义机器人的映射关系,实现将GitLab上项目相关的Webhook事件推送消息到项目对应的钉钉群

mr dtu 命令帮助菜单:

$ mr dtu -h

mr dtu <命令>

操作GitLab项目与钉钉机器人URL的映射数据(DingTalkUrl)

命令:
  mr dtu get <project_id>                                     查看项目,参数解释: <GitLab项目ID>
  mr dtu list                                                 查看全部项目
  mr dtu set <project_id> <dingtalk_url>                      设置项目,参数解释: <GitLab项目ID> <钉钉自定义机器人URL>
  mr dtu update <old_project_id> <project_id> <dingtalk_url>  更新项目,参数解释: <GitLab项目ID> <新的GitLab项目ID> <钉钉自定义机器人URL>
  mr dtu delete <project_id>                                  删除项目,参数解释: <GitLab项目ID>

配置文件

mr-cliv1.0.3 版本中改进了 projectId 的获取逻辑:

  • 自动根据当前项目名查找项目ID

因此,一般情况下,无需关心项目ID配置;

但是,根据项目名查找项目ID,可能会出现重名的项目查找出错或其它意想不到的情况;

所以,这里还是保留配置文件的方案,在获取项目出错时,可以通过手动配置的方式解决。

另外,配置文件除了 projectId,还可以配置 targetBranchsourceBranch

创建配置文件

在项目根目录下创建配置文件 .mrconfig.js

// .mrconfig.js
module.exports = {
  // GitLab 项目ID
  projectId: 0,
  // 发起MR的源分支,默认当前分支
  sourceBranch: 'xxx',
  // 发起MR的目标分支,默认develop
  targetBranch: 'develop',
};

如果不想创建配置文件,也可以在项目的 package.json 文件中增加 mrConfig 属性,该属性的配置同上

// package.json
{
  ...
  "mrConfig": {
    "projectId": 0
  }
}

优先级为 .mrconfig.js > package.json[mrConfig]