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

@petercjl/alicli

v0.1.1

Published

CLI for safe, Agent-driven Alibaba.com ecommerce data workflows

Readme

alicli

alicli 是面向 Agent 和业务人员的 Alibaba.com 电商数据 CLI。稳定命令提供可发现的能力、机器可读 JSON、明确错误码、专用浏览器会话、请求节奏控制和完整性检查。

当前稳定业务能力:从一个 Alibaba.com 商品详情链接导出该店铺的文字评价 Excel。

安装

npm install -g @petercjl/alicli
alicli --version
alicli doctor

要求 Node.js 20 或更高版本以及 Google Chrome。当前在 macOS Apple Silicon 上完成真实测试;Windows 和 Linux 的 Chrome 探测代码已提供,但尚未完成发布级实机验证。

能力发现

alicli capabilities
alicli capabilities --json
alicli capabilities --all

capabilities --json 是 Agent 的稳定发现入口。命令路由、帮助与能力信息由同一个注册表生成。

店铺评价导出

alicli reviews store \
  --url 'https://www.alibaba.com/product-detail/example_1234567890.html' \
  --out store-reviews.xlsx

机器调用:

alicli reviews store \
  --url 'https://www.alibaba.com/product-detail/example_1234567890.html' \
  --out store-reviews.xlsx \
  --json

Excel 包含:

  • 概览;
  • 可筛选的评价明细;
  • 评分分布。

默认每页 50 条。--max-pages N 只用于小样本或明确的有限导出;未设置时,CLI 会核对可导出文字评价数和最终去重评价数,不完整则返回 PARTIAL_DATA。

浏览器与安全

CLI 使用专用、持久的电商浏览器身份:

  • 默认 CDP:http://127.0.0.1:9223
  • 默认 Profile:~/.dianshang-chrome-profile

业务命令会在需要时尝试启动 Chrome。首次使用或登录失效时,请在打开的浏览器中人工完成 Alibaba.com 登录后重新执行。

CLI 会在页面加载、接口拦截等待、每次 API 调用前、随机延时后以及 API 返回后检查登录和验证状态。每次 API 请求前随机等待 1000–2000ms;可以用 --min-delay-ms 和 --max-delay-ms 设置更慢范围,但最小值不能低于 1000ms。遇到未登录、登录表单、验证码、安全验证、访问限制或限流时立即停止,不再调用下一页 API,也不会自动刷新或绕过。

环境变量:

| 变量 | 用途 | | --- | --- | | ALICLI_CDP_URL | CDP 地址 | | ALICLI_REMOTE_DEBUGGING_PORT | Chrome 调试端口 | | ALICLI_CHROME_PROFILE | 持久浏览器 Profile | | ALICLI_CHROME_PATH | Chrome 可执行文件 |

JSON 契约

成功:

{
  "schemaVersion": "1.0",
  "ok": true,
  "command": "store-reviews-export",
  "data": {}
}

失败:

{
  "schemaVersion": "1.0",
  "ok": false,
  "command": "store-reviews-export",
  "error": {
    "code": "AUTH_REQUIRED",
    "message": "需要人工登录"
  }
}

stdout 只输出最终结果;进度输出到 stderr。失败返回非零退出码。

稳定错误码:

  • INPUT_REQUIRED
  • INVALID_INPUT
  • UNKNOWN_COMMAND
  • ENVIRONMENT_ERROR
  • AUTH_REQUIRED
  • VERIFICATION_REQUIRED
  • RATE_LIMITED
  • PARTIAL_DATA
  • INTERNAL_ERROR

开发验证

npm install
npm test
npm pack --dry-run

新增业务能力时必须更新命令注册表,并补充参数、安全、分页、完整性、JSON、错误码、Excel 和打包测试。