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

cha-kungfu-cli

v0.0.32

Published

命令行工具

Readme

cha-kungfu-cli

茶姬经营管理 CLI。命令从业务 domain 直接开始,不采用 group 层级。

npm start -- list
npm start -- schema store-ordering
npm start -- schema store-ordering.products

发现与查询流程:

  • 使用 cha-kungfu-cli list --format json 查找业务 domain。
  • 使用 cha-kungfu-cli schema <domain>[.<resourceOrAction>] 查询业务 domain 下的动作命令列表,或继续查询 resource 下的动作命令。
  • 使用 cha-kungfu-cli schema <domain>[.<resourceOrAction>][.<action>] 查询单个命令的 HTTP 方法、路径、参数和风险等级,例如 cha-kungfu-cli schema store-inventory.list。

命令路径不限制层级;例如五级命令可通过 schema <domain>.a.b.c.d 查询,并以 cha-kungfu-cli <domain> a b c d 执行。

复合命令的 schema 只返回 commands 子动作列表,不混入父命令契约。例如 cha-kungfu-cli schema store-ordering.cart 会列出 cart、count、update、delete 与 clear。

已实现的门店业务 domain:

cha-kungfu-cli store-ordering products
cha-kungfu-cli store-inventory overview
cha-kungfu-cli store-inventory-tally plans
cha-kungfu-cli store-allocation list
cha-kungfu-cli schema store-ordering.create

这五个 domain 已登记所有门店端/H5 接口,明确排除了管理端、回调和健康检查接口。命令会执行从 Apifox 导入的接口契约(HTTP 方法、路径、风险等级)。

接口地址与认证信息通过 init 保存到本机 CLI 配置。KUNGFU_API_BASE_URL 填服务域名或任一已知网关地址即可;CLI 会依据接口文档来源自动选择网关:库存作业中心为 /api/oms-ioc、门店库存管理为 /api/oms-iac、库存调度中心为 /api/oms-ims。

cha-kungfu-cli init \
  --KUNGFU_API_BASE_URL='<api-base-url>' \
  --KUNGFU_AUTHORIZATION='Bearer <authorization-token>' \
  --KUNGFU_SCHEMA_KEY='<api-schema-decryption-key>'

# 先预览请求;写操作不会发送
cha-kungfu-cli store-ordering checkout --data '{"isCat":true,"order":{"receiveAddress":{"storeName":"门店"}}}' --dry-run

# 写操作需要明确确认
cha-kungfu-cli store-ordering checkout --data '{"isCat":true,"order":{"receiveAddress":{"storeName":"门店"}}}' --confirm

购物车与结算

cart 聚合购物车操作;action 支持 cart(默认查询)、count、update、delete 与 clear。变更购物车时先使用 --dry-run,确认后再传入 --confirm。

cha-kungfu-cli store-ordering cart --data '{"action":"cart"}'
cha-kungfu-cli store-ordering cart --data '{"action":"update","spuCode":"sku-1","quantity":2}' --dry-run

checkout 按结算页顺序执行商品校验、结算、获取幂等键和创建订单。订单创建属于写操作,必须先预览再确认执行。

cha-kungfu-cli store-ordering checkout --data '{"isCat":true,"order":{"receiveAddress":{"storeName":"门店","receiveAddress":"收货地址","receiverName":"收货人","receiverPhone":"手机号"}}}' --dry-run

通用参数:--base-url、--token、--data <JSON>、--params <JSON>、--path-params <JSON>、--dry-run、--confirm。认证使用 --token 或 KUNGFU_AUTHORIZATION 之一;CLI 会自动将该值同时设置到 Authorization 与 blade-auth。

init 将三个凭据以仅当前用户可读的权限保存到 ~/.config/cha-kungfu-cli/config.json,且不会在输出中回显值。接口文档以 AES-256-GCM 加密保存;schema 与业务命令都必须提供 KUNGFU_SCHEMA_KEY。CLI 也会兼容当前工作目录的 .env 和系统环境变量。

无需安装依赖即可运行;需要全局命令时执行 npm link。