@drkmttr/adhere

中文文档
0.25.0发布于 2026/11/12MITES Module构建来源已验证近 30 天下载 9480

Lints a repository against the rules in .adhere/, judged by Jev.

原始使用文档
文档目录3 节
  1. Get started
  2. Docs
  3. Contributing and license

adhere


A linter for non-deterministic rules. Powered by TypeSafe AI.

   

A linter for rules a normal linter cannot check, such as "business logic should live in services" or "modules should expose lots of functionality behind a small API". You can write a rule as a Markdown file, with code that shows it:

---
description: A third-party API going offline should not also take our app down.
---

Our APIs should not depend on a third-party API on a critical path. The
user-facing side should be unaffected if it goes offline, and ingestion should
happen in a separate, asynchronous process.

## Should

```ts
// GET /api/restaurants/:zipCode reads only our own database.
export async function findRestaurants(zipCode: string) {
  return db.restaurants.find({ where: { zipCode } });
}
```

## Should not

```ts
// When Google Maps is down, slow, or over quota, so is this endpoint.
export async function findRestaurants(zipCode: string) {
  return googleMaps.findAll({ where: { zipCode } });
}
```

adhere asks Jev, TypeSafe AI's System One model, whether each file breaks each rule which returns a calibrated probability. adhere reports each rule whose probability is above a threshold, and shows the part of the file Jev points at. The report looks like Oxlint's:

adhere lint demo

Rules a normal linter can check exactly, such as a banned import or a type error, belong in that linter. adhere validate lists the rules Jev thinks a linter could check, and finds rules that contradict each other.

Get started

curl -fsSL https://github.com/darkmatter/adhere/raw/main/scripts/install.sh | sh
adhere login                           # save your TypeSafe AI API key
adhere lint --preset typescript,react  # try the built-in presets on your code
adhere init                            # scaffold .adhere/config.ts and two example rules
adhere rules create                    # write a rule with a coding agent: claude, codex, or omp

The script installs to ~/.local/bin. If your shell can't find adhere afterwards, add that directory to your PATH. adhere lint estimates what judging will cost. When stdin and stdout are terminals, it asks before it sends anything; otherwise, or with --yes, it sends without asking. The package is @drkmttr/adhere: adhere on npm is an unrelated package.

Docs

Contributing and license

MIT. See LICENSE. The executables attached to each GitHub release come with LICENSE and THIRD_PARTY_NOTICES.txt, which go with any copy you redistribute. To build, test, or release adhere from a checkout, see CONTRIBUTING.md.

版本与发布记录

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

版本发布日期距今
0.25.0latest2026/11/121 天前
0.24.12026/11/112 天前
0.24.02026/11/058 天前
0.23.02026/11/058 天前
0.21.22026/10/2618 天前
0.18.12026/10/121 个月前

关于 @drkmttr/adhere 的常见问题

@drkmttr/adhere 是什么?

Lints a repository against the rules in .adhere/, judged by Jev.

如何安装 @drkmttr/adhere?

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

@drkmttr/adhere 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/drkmttr__adhere 是否存在。

@drkmttr/adhere 支持 ESM 还是 CommonJS?

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

@drkmttr/adhere 可以商用吗?

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

@drkmttr/adhere 的下载量有多少?

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

@drkmttr/adhere 还在维护吗?

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