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

brand-cli

v0.1.24

Published

类型安全(来自自动 OpenAPI)的 brand-context 管理端 CLI

Readme

brand-cli

类型安全(来自自动 OpenAPI)的 brand-context 管理端 CLI。

仅供 brand-context 后端使用。它只连你自己的后端实例,对第三方无作用。

安装

npm install -g brand-cli

或本地用 npx:

npx brand-cli --help

配置(环境变量)

| 变量 | 说明 | 默认 | | --- | --- | --- | | BRANDCLI_BASE | 后端地址 | http://localhost:3100 | | BRANDCLI_TOKEN | 管理端 token(Bearer) | 空 | | ADMIN_TOKEN | 兜底读取 .envADMIN_TOKEN | 空 |

--token <t> 命令行参数可覆盖环境变量。

命令

# 读
brand-cli entities list [--category X] [--includeArchived]
brand-cli entity get <id>
brand-cli coverage [--includeArchived]
brand-cli products list [--includeArchived]

# 实体:写
brand-cli entity data get <id|key> [--locale en]   # 读取某语言层 JSON(只读,key 自动解析为 id;输出为裸 JSON)
brand-cli entity create --key K [--category C] [--recordLabel R] [--source S] [--schemaHint @file.json]   # key 必须 ^[a-z0-9_]+$(非法字符 400)
brand-cli entity update <id> [--category C] [--status S] [--recordLabel R] [--source S] [--schemaHint @file] [--if-match V]
brand-cli entity delete <id>                      # 软删(archived);自动 If-Match: *
brand-cli entity data set <id> --locale en --data @file.json | -d '{...}' | -d -   # data 必须【嵌套在实体 key 下】,扁平 JSON → 400
brand-cli entity data rm <id> --locale en         # 默认 If-Match: * 通配走 LWW(服务端 2026-08-19 起接受)
brand-cli entity recompute <id>
brand-cli entity rename-field <id> --from F --to T

# 产物:写 + 发布生命周期
brand-cli product create --slug S [--name N] [--sourceDir D] [--defaultLocales en,cn]
brand-cli product update <id> [--name N] [--description D] [--defaultLocales en,cn] [--status S] [--if-match V]
brand-cli product delete <id>
brand-cli product publish <id> [--locales en,cn]
brand-cli product unpublish <id>
brand-cli product add-item <id> --entity <entityId>
brand-cli product rm-item <id> <itemId>
brand-cli product reorder <id> --order id1,id2,id3

# 分类
brand-cli category create --key K [--label L] [--color #hex] [--order N]
brand-cli category update <key> [--label L] [--color #hex] [--order N]
brand-cli category delete <key>

brand-cli --help

写操作默认自动带 If-Match 乐观锁(last-write-wins);CLI 发 If-Match: * 通配 + x-vercel-bypass: 1 绕过 Vercel CDN ETag 412;--if-match <v> 可显式覆盖。

本地开发(在 brand-context 主仓库内)

主仓库用 npm run cli -- <cmd>(tsx 直跑);本目录是独立可发布的打包产物,发布前:

cd brand-cli
npm install      # 装 esbuild(devDependency)
npm run build    # 编译 src/cli.ts -> dist/cli.js
npm publish      # 公开发包

响应类型来自主仓库 src/api-types.d.ts(由 npm run gen:types 重新生成)。src/cli.tsimport type 引用,构建时被 esbuild 擦除,故 dist/cli.js 是自带运行时的自包含产物,无需把类型文件复制到此目录。