@chatluna/patchbay

中文文档
0.1.11发布于 2026/11/09MITTypeScriptES Module近 30 天下载 2029

Cordis 4 patches for Koishi, Satori, Satori adapters and Cordis plugins, wired into yarn, pnpm or npm

原始使用文档
文档目录4 节
  1. Use
  2. From code
  3. Maintain
  4. License

patchbay

Patches that run Koishi, Satori, the Satori adapters and a few Cordis plugins on Cordis 4, kept in one place and wired into yarn, pnpm or npm by one command.

Each patch targets one exact upstream version listed in patchbay.json. Nothing is republished: your package manager installs the upstream tarball and applies the patch from this package.

Use

npm i -D @chatluna/patchbay      # or yarn add -D / pnpm add -D
npx patchbay sync                # writes .patchbay/ and the package-manager config
npm install                      # or yarn install / pnpm install

Commit .patchbay/ together with the config sync writes. Run patchbay sync again after upgrading patchbay. It replaces every pin the previous version wrote.

Package managerWhat sync writesWhen patches apply
Yarn 2+resolutions → patch:<pkg>@npm:<version>#~/.patchbay/<pkg>@<version>.patchon install
pnpm 10+pnpm-workspace.yaml: overrides, patchedDependencies, allowUnusedPatcheson install
npmoverrides, direct dependencies pinned to the same spec, postinstall: patchbay applyafter install, in place

sync reads the package manager from packageManager, then the lockfile, then the one running it. Pass --pm yarn|pnpm|npm to choose it yourself. Yarn 1 has no patch support and is rejected.

Every patched package is pinned to its patched version, along with these aliases:

  • koishi → @koishijs/core
  • minato → @cordisjs/plugin-database

A plugin that later installs one of them gets the patched build.

On npm, patchbay apply keeps a copy of the patch it applied in each package (.patchbay.patch). It skips packages that are already current and undoes an older patch before applying a newer one.

From code

import { apply, sync } from '@chatluna/patchbay'

const pm = sync(projectDir) // 'yarn' | 'pnpm' | 'npm'
// ...run the install...
if (pm === 'npm') apply(projectDir)

Maintain

yarn refresh edit <name>     # unpack upstream to .work/<pkg>/{a,b}, current patch applied to b
# edit .work/<pkg>/b
yarn refresh commit <name>   # diff a → b into patches/<pkg>@<version>.patch
yarn verify                  # every patch applies to its upstream tarball
yarn test                    # unit tests plus real yarn, pnpm and npm installs

To patch a new package or version, add its entry to patchbay.json, run yarn refresh edit <name>, make the change, then commit it.

License

MIT

版本与发布记录

@chatluna/patchbay 共发布 13 个版本,首次发布于 2026/11/03;过去 12 个月发布了 13 个版本。

版本发布日期距今
0.1.11latest2026/11/09今天
0.1.102026/11/09今天
0.1.92026/11/072 天前
0.1.82026/11/072 天前
0.1.72026/11/063 天前
0.1.62026/11/063 天前

关于 @chatluna/patchbay 的常见问题

@chatluna/patchbay 是什么?

Cordis 4 patches for Koishi, Satori, Satori adapters and Cordis plugins, wired into yarn, pnpm or npm

如何安装 @chatluna/patchbay?

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

@chatluna/patchbay 支持 TypeScript 吗?

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

@chatluna/patchbay 支持 ESM 还是 CommonJS?

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

@chatluna/patchbay 需要什么版本的 Node.js?

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

@chatluna/patchbay 可以商用吗?

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

@chatluna/patchbay 的下载量有多少?

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

@chatluna/patchbay 还在维护吗?

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