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

yz-mg-cli

v1.1.8

Published

MG CLI 登录工具

Downloads

1,494

Readme

yz-mg-cli

MG CLI 登录工具。通过 npx 使用,无需下载各操作系统二进制文件。

npx -y yz-mg-cli@latest login --account <账号或手机号> --password <密码> --field token

默认服务地址为 https://mg-cli.meimeifa.com,本地或其他环境可通过 --base-url 覆盖。默认输出的 token 是 MG session token,默认 24 小时过期;需要续期时可使用 refresh,刷新成功后旧 MG token 失效。 loginsalon-login 成功后会自动把授权响应缓存在本机,不保存密码。默认缓存路径为 macOS ~/Library/Application Support/yz-mg-cli/auth.json、Linux ${XDG_CONFIG_HOME:-~/.config}/yz-mg-cli/auth.json、Windows %APPDATA%\yz-mg-cli\auth.json;可用 --cache-fileMG_CENTER_CACHE_FILE 指定缓存文件,也可用 --no-cacheMG_CENTER_NO_CACHE=1 禁用缓存。

--field 支持 tokenoaTokennbTokenqudaoTokenzentaoTokenall,也支持 oanbqudaozentao 简写。 --timeout-ms 可设置请求超时时间,默认 30000。 CLI 会读取 HTTPS_PROXYHTTP_PROXYALL_PROXY 及对应小写环境变量。

也可以通过环境变量传参:

MG_CENTER_BASE_URL=https://mg-cli.meimeifa.com \
MG_CENTER_ACCOUNT=<账号或手机号> \
MG_CENTER_PASSWORD=<密码> \
npx -y yz-mg-cli@latest login --field all

刷新 MG token:

npx -y yz-mg-cli@latest refresh --token <MG token> --field token

也可以通过环境变量传刷新 token;如果本机已有 login 缓存,也可以省略 token:

MG_CENTER_TOKEN=<MG token> npx -y yz-mg-cli@latest refresh --field all
npx -y yz-mg-cli@latest refresh --field token

门店系统登录:

npx -y yz-mg-cli@latest salon-login --account <门店账号> --password <密码> --field token
npx -y yz-mg-cli@latest salon-login --account <门店账号> --password <密码> --field zone_id

salon-login 会调用 /api/auth/salon-login,保留 loginCenter 原始返回结构。默认只输出 response.token--field zone_id--field zone 输出 response.zone_id--field all 输出完整 JSON。

门店账号也可以通过环境变量传参,适合 AI Agent 或自动化任务复用:

MG_SALON_ACCOUNT=<门店账号> \
MG_SALON_PASSWORD=<密码> \
npx -y yz-mg-cli@latest salon-login --field all

私域宝账号列表:

# 先运行 salon-login 写入门店授权缓存
npx -y yz-mg-cli@latest salon-login --account <门店账号> --password <密码> --field token

# 连锁管理和门店管理账号可列出私域宝账号和 token
npx -y yz-mg-cli@latest salon-syb-list --field all

# 只输出私域宝账号 token,或按手机号过滤
npx -y yz-mg-cli@latest salon-syb-list --field token --handset <手机号>

# 使用缓存中的门店授权和私域宝账号 token 发送私聊文本
npx -y yz-mg-cli@latest salon-syb-send --robot-id <机器人 robot_id> --sender-id <好友 robot_id> --text "你好"

# 发送群图片,图片必须是 HTTPS
npx -y yz-mg-cli@latest salon-syb-send --robot-id <机器人 robot_id> --group-id <群 robot_id> --image-url https://example.com/wky.jpg

salon-syb-list 会调用 /api/wky/accounts,优先读取本机 salon-login 缓存里的 response.tokenresponse.zone_id;也可以显式传 --salon-token <门店 token> --zone z1。命令会为每个可用账号继续调用 /api/wky/seat,默认输出并缓存 { accounts, seats }--field token 会逐行输出可用私域宝账号 token。salon-syb-send 会优先读取本地 salonSyb 缓存,按 --robot-id 自动找到私域宝账号 token 和 seatType。 服务端仍会校验 SaaS 账号类型,只有 1-连锁管理3-门店管理 可以访问。 如果同一个 robot-id 匹配多个私域宝账号,发送时需要显式传 --wky-token

本地调试缓存位置:

MG_CENTER_CACHE_FILE=/tmp/yz-mg-cli-auth.json \
npx -y yz-mg-cli@latest login --account <账号或手机号> --password <密码>

不发布到 npm、本地直接调试当前包里的 CLI:

bun run dev -- --help
bun run dev -- salon-syb-list --base-url http://127.0.0.1:3000 --field all
bun run dev -- salon-syb-send --base-url http://127.0.0.1:3000 --robot-id <robot_id> --sender-id <sender_id> --text "测试"