Getting Started
Save your TypeSafe AI API key once (see Login), then try the built-in presets on your code before you write a rule of your own:
npx adhere loginnpx adhere lint --preset typescript,reactPresets cover TypeScript, React, security, Effect, and alchemy. See Presets.
To set up rules of your own:
npx adhere init # .adhere/config.ts, two example rules, and the dependencynpx adhere validate # check your rules' wording, and ask Jev whether any contradictnpx adhere lint # audit the working directorygit add .adhere # commit the rules, and the judgments they costadhere init creates a config file and some example rules, and adds adhere
as a dev dependency.
It is safe to rerun: existing files are reported as skipped, and only --force
overwrites them.
The day-to-day loop
Section titled “The day-to-day loop”After that, using adhere is a short loop:
- Write or edit a rule in
.adhere/rules/. A rule is one sentence saying what code must be, with code that shows it: see Rule format. - Run
adhere lint. It says what it found and what judging takes, and asks before it sends anything: see Running lint. - Read the findings. Each finding names the rule, Jev’s probability, and the lines it points at: see Reading the report.
- Fix the code, the rule, or neither. A wrong finding is usually the rule’s wording reaching too far: see Writing good rules. Suppress a finding that is wrong for this code alone with a comment that says why: see Comments and suppressions.
- Commit
.adhere/, cache included. Judgments are cached by file content and rule text, so the next run, and CI, only pay for what changed: see Cache.