Skip to content
darkmatterPublic

About

A linter for rules a normal linter can't check. (powered by Typesafe)

Resources

Contributing

Stars

35 stars

Watchers

0 watching

Forks

Repository files navigation

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.

About

A linter for rules a normal linter can't check. (powered by Typesafe)

Resources

Contributing

Stars

35 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages