@cookiemunch/cli

中文文档
0.18.2发布于 2026/11/07MITTypeScriptES Module构建来源已验证近 30 天下载 4159

cookiemunch — config as code, banner previews and connection tests from a terminal or CI, over the Cookie Munch Developer API

原始使用文档
文档目录3 节
  1. Commands
  2. Environment
  3. Documentation

@cookiemunch/cli

cookiemunch: the Cookie Munch Developer API from a terminal or a CI job. Keep a site's banner config in git, preview the banner, run the declaration presets, scan a site, and manage the hosted rights page, all with one API key.

npm install -g @cookiemunch/cli      # or run any command with: npx @cookiemunch/cli ...
export COOKIEMUNCH_API_KEY=fck_...   # Dashboard > Developers > API keys

cookiemunch config pull --site acme-com-9f3k --out cookiemunch.json
cookiemunch config diff --site acme-com-9f3k cookiemunch.json
cookiemunch config push --site acme-com-9f3k cookiemunch.json

config diff shows what a push would change (the server's own dry run) and sends nothing; the read-only fields a pulled file carries (effective, designWarnings, ...) are ignored, so an unedited pull reports "No changes". Add --replace to compare against a whole-document replace, --exit-code to fail a CI job when something differs.

Commands

config pull|diff|push|validate, preview, scan, cookies presets|preset|unpreset|retire|unretire|delete-observed, rights-page pull|diff|push|publish, executors ..., site, health, keys, partners, provision, doctor, scan-source [dir] (cookie and storage names your source sets, as cookiemunch.json rows; no key), types [--out file] [--for react,embed] (a .d.ts of the site's categories for @cookiemunch/react and/or @cookiemunch/sdk/embed). Run cookiemunch --help for every flag.

cookiemunch doctor [--site <cbid>] [--org <id>] checks your setup in one go: the key (and whose organisation it belongs to, against --org or COOKIEMUNCH_ORG), its expiry, the CLI version against the latest, and integration health. It exits 1 when a check fails, so it works as a CI step.

Environment

VariableRequiredDescription
COOKIEMUNCH_API_KEYyesAn API key (cookiemunch_live_...).
COOKIEMUNCH_ORGnoThe organisation doctor checks the key against when no --org is given.
COOKIEMUNCH_SITEnoThe site (cbid) used when a command is given no --site.
COOKIEMUNCH_BASE_URLnoThe API origin. Default https://api.cookiemunch.net.
COOKIEMUNCH_USER_AGENTnoThe User-Agent sent to the API. Default cookiemunch-cli/<version>.

Exit codes: 0 success, 1 the API refused or the network failed (or --strict found a design warning), 2 a usage mistake.

If a call fails with 403 error code: 1010, the request carried no real User-Agent; see the error-codes page below.

Documentation

Full reference: https://cookiemunch.net/docs/cli. Release notes: CHANGELOG.md.

版本与发布记录

@cookiemunch/cli 共发布 28 个版本,首次发布于 2026/10/15;过去 12 个月发布了 28 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.18.2latest2026/11/073 天前
0.18.12026/11/064 天前
0.18.02026/11/064 天前
0.17.12026/11/065 天前
0.17.02026/11/065 天前
0.16.02026/11/055 天前

关于 @cookiemunch/cli 的常见问题

@cookiemunch/cli 是什么?

cookiemunch — config as code, banner previews and connection tests from a terminal or CI, over the Cookie Munch Developer API

如何安装 @cookiemunch/cli?

在项目目录运行 npm install @cookiemunch/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 cm、cookiemunch,可以用 npx cm 直接运行。

@cookiemunch/cli 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cookiemunch/cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@cookiemunch/cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@cookiemunch/cli 可以商用吗?

@cookiemunch/cli 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@cookiemunch/cli 的下载量有多少?

根据 npm 官方下载统计,@cookiemunch/cli 在 2026/10/11 – 2026/11/09 这 30 天内被下载 4,159 次,日均约 139 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cookiemunch/cli 还在维护吗?

最新版本 0.18.2 发布于 2026/11/07(3 天前);至今共发布 28 个版本,其中过去 12 个月发布了 28 个;首次发布于 2026/10/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。