@kerno/cli

中文文档
1.1.1发布于 2026/11/01SEE LICENSE IN LICENSEES Module

Kerno CLI - Local runtime backend testing inside your coding agent's loop.

原始使用文档
文档目录17 节
  1. Installation
  2. Connect to Claude Code or Cursor
  3. Commands
  4. Global options
  5. kerno audit
  6. How the judge works
  7. When a report says nothing was read
  8. How It Works
  9. 1. Codebase indexing
  10. 2. Zero-config environment orchestration
  11. 3. Baseline Capture & Diff Detection
  12. 4. Self-Healing Maintenance
  13. Why Teams Choose Kerno
  14. Security & Privacy
  15. What kerno audit collects
  16. Requirements
  17. Learn More

Kerno: Catch breaking backend changes and unintended side effects before raising a PR

AI tools generate backend code fast, but you still need to verify it actually works.

Kerno is a validation engine that helps you catch breaking changes in your AI backend code before raising your PR. It automatically generates, runs, and maintains high-quality integration with full codebase context.

When you make changes, Kerno validates them against your real service and dependencies to catch breaking changes and unintended side effects. All directly in your terminal or IDE with instant feedback.

Installation

Run on demand with npx (no install):

npx @kerno/cli init

Or install globally:

npm install -g @kerno/cli
kerno init

Requires Node.js 18+.

Connect to Claude Code or Cursor

kerno init starts the Kerno agent (if not already running) and prints the MCP server configuration for your AI coding assistant.

Claude Code — run the command Kerno prints:

claude mcp add --transport http kerno http://localhost:<port>/mcp

Cursor — copy the printed snippet into .cursor/mcp.json:

{
  "mcpServers": {
    "kerno": {
      "url": "http://localhost:<port>/mcp",
      "transport": "http"
    }
  }
}

Once connected, your AI assistant can drive Kerno to generate, run, and validate integration tests against your real stack.

Commands

CommandDescription
kerno auditAudit what AI-assisted development did to this repository
kerno initStart the agent and show MCP config for Claude Code and Cursor
kerno stopStop the Kerno agent
kerno statusCheck system status
kerno logsStream workspace logs from the running agent
kerno loginLog in to Kerno
kerno logoutLog out from Kerno
kerno uninstallStop the agent and remove installed binaries

Run kerno with no arguments to launch the interactive shell, or kerno --help to see all options.

Global options

OptionDescription
-w, --workspace <path>Workspace path (defaults to current directory)
-v, --verboseShow Kerno diagnostic logs
--force-updateForce re-download of the agent (applies to start and mcp)
-V, --versionShow version number
-h, --helpShow help

kerno audit

Gated by the PostHog feature flag kerno-audit (@kerno.io emails, on in env=dev, off in env=prod). The CLI sends env at flag evaluation from BACKEND_URL. Log in with a flagged account; otherwise audit is unknown.

Reads your git history and reports what changed after AI coding agents arrived. Read-only, no checkout of your repository disturbed. Minutes for a normal repository. Computed locally except the judge, which sends small source extracts to TypeSafe's decision API — see How the judge works.

cd your-repo
kerno audit

It asks two questions, because neither can be answered reliably from the repository alone:

  1. When did AI coding agents arrive? It proposes a month from agent identities and Co-authored-by trailers, shows the evidence it used, and takes your correction. If its two detection rules disagree with the history, it says it cannot date adoption rather than inventing a month.
  2. How much history should the comparison use? Twelve months by default. Six has given the opposite sign to twenty-four on a real repository, so prefer twelve or more.

Then it reports, with the named functions and commits behind each one:

  • Reimplementation — functions written that the codebase already had.
  • Complexity — branching per change, measured against the repository's own prior trend rather than a bare before/after. A result that trend already explains is marked confounded and kept out of the headline.
  • Rework — later commits that rewrite a recent commit's code, and how long a change survives before it is first rewritten.

A commit with no AI trailer is reported as unknown, never as human: the AI figure is a floor on involvement, not a measurement of it. The audit does not measure defects — it reads git, never a bug tracker, so it can neither confirm nor deny anything about AI and bug rates.

OptionDescription
--root <path>Repository to audit (default: current directory)
--adoption <YYYY-MM|auto|none>Set the month, accept the detected one unattended, or run with no comparison
--baseline <3|6|12|24>Months of history before adoption to compare against
--plugins <a,b>Run only these metrics
--budget <usd>Hard cap on model spend for the run
--trace-judgeRecord every model request and answer in full, for review
-y, --yesAccept every default; never prompt

The report lands in ~/.kerno/audit/runs/<name>/report.md.

How the judge works

Where a measurement is genuinely undecidable by static analysis, one closed question about one pair of things goes to a model — two function bodies, or a commit-message pair and one file's diff. It never scores a whole change and never searches your code.

Those questions go to TypeSafe's decision API, which runs on OpenAI models, reached through Kerno's Bifrost gateway and billed to your organization. Source from this repository therefore leaves your machine. Per run, at most:

SentVolumeWhy
Pairs of function bodies80 requests, 40 lines of source per functionTell a reimplementation from a coincidence
A commit-message pair plus one file's diff120 requests, 8,000 characters of diff eachTell a repair from an extension
A commit diff (only with --enable complexity-judge)60 requests, 12,000 characters eachTell a justified complexity increase from an avoidable one

Those are ceilings; --budget usually binds first. The caps themselves live in the plugins — MAX_JUDGED and MAX_QUOTE_LINES in plugins/duplication, MAX_JUDGED and DIFF_BUDGET in plugins/followups and plugins/complexity — so this table has to be re-read against them when they change.

A diff is raw git diff output, so it carries its diff --git a/<path> and ---/+++ headers: repo-relative file paths go with it, as do the commit messages. Whole files, the repository name and the codebase index do not.

If TypeSafe rate-limits part-way through a run, or the account it bills has run out of credit, the remaining questions go to an OpenAI decision model instead, through the same gateway and billed the same way. Neither a 429 nor an empty balance is a verdict, and without a fallback the run reports unjudged for everything it did not get to — measuring our concurrency and our billing rather than your repository. A rate limit diverts for a minute and then tries TypeSafe again; an empty balance diverts for the rest of the run, because nobody tops up a balance in the time an audit has left. Fallback answers are counted separately in the report and marked fallback in the ledger and trace, so a stand-in verdict is never mistaken for a primary one. OPENAI_API_KEY overrides the gateway with your own account; AUDIT_FALLBACK_MODEL picks a different model.

--trace-judge records every request and reply verbatim under the run directory, so you can read exactly what was sent rather than take this on trust. To judge nothing at all, pass --budget 0, or run without a Kerno session — every judged measure then reports itself as unjudged rather than guessed.

When a report says nothing was read

The audit parses with tree-sitter grammars that ship inside codegraph's package for your platform, and reads codegraph's index through node:sqlite, which needs Node 22. Both fail quietly: a grammar that is not installed is a legitimate state, so the run succeeds and every number is computed from a tree it never read.

kerno audit --doctor

checks each one directly — it installs codegraph if missing, indexes a throwaway repository and reads the index back, then parses a sample function with every configured grammar — and exits non-zero if anything is broken.

  ok    node:sqlite          available on v22.22.2
  ok    codegraph            ~/.kerno/audit/tools/node_modules/.bin/codegraph
  ok    codegraph index      1 symbols read back
  ok    tree-sitter grammars 16 ready: typescript, tsx, javascript, python, ...

How It Works

1. Codebase indexing

Kerno indexes your codebase to build a deep understanding of how everything works together. Kerno supports TypeScript, JavaScript, Python (Go, PHP, Ruby, Java coming soon).

Codebase indexing

2. Zero-config environment orchestration

Kerno automatically orchestrates your application and its dependencies (PostgreSQL, Redis, MongoDB, Kafka, RabbitMQ, and more) locally with zero manual configuration.

Environment

"Kerno was up and running in minutes with no manual work, and it made our API migration so much smoother. We could instantly validate that every change made by Cursor worked the way we expected, and now it's a core part of how we build." — Misch Strotz, Co-Founder & CEO, Letz AI

3. Baseline Capture & Diff Detection

Kerno captures the baseline behavior of critical paths for your REST endpoints, then compares your code changes to the baseline and flags any diffs.

What Kerno validates:

  • Functional API workflows
  • Contract & schema validation
  • Error handling & resilience
  • Authorization & authentication
  • Boundary & edge cases

Capture & Diff Detection

"Kerno saves us a lot of manual work and helps us catch side effects and issues that would definitely break our projects' backends. Our engineering team loves it." — Santiago J. Valls, Co-Founder & CTO, BeWise

4. Self-Healing Maintenance

As your app evolves, Kerno updates your tests to keep everything in sync without manual effort. Tests are added as features appear and retired as code changes—keeping your suite complete and consistent.

Self-Healing

Why Teams Choose Kerno

  • 35% fewer breaking backend changes and unintended side effects
  • 3X faster feedback loops for developers, leading to fewer PR bottlenecks
  • 10+ hours saved each week per developer troubleshooting integration issues post-CI

"Using Kerno with Claude Code has been a game changer. You get quick feedback with no manual effort, and it saves you a lot of time and hassle debugging integration issues post-merge." — Jonathan Bernales, CTO, Germen

Security & Privacy

  • The codebase index is stored locally – Indexing is local and the index itself stays on your machine. kerno audit is the exception: when a measurement cannot be settled statically it sends source extracts, with the file paths in their diff headers, to TypeSafe's decision API — see How the judge works for exactly what and where.
  • Never used for training – Your private code is strictly off-limits
  • Enterprise security – SOC 2 Type II compliance in progress
  • Encryption – TLS 1.2 in-transit, AES 256-bit at-rest

What kerno audit collects

The first audit on a machine shows this on screen and asks before anything runs. The answer is kept in ~/.kerno/audit/sharing.json; kerno audit --data-sharing asks again.

Uploading the run, with the quoted code behind each finding, is the default — including where there is no terminal to show the disclosure on, such as CI or a coding agent. Opting out is a flag away and the flags are listed below, but a pipeline that nobody has configured will send results and source to the organization it is signed in as. A run with no Kerno session uploads nothing, because it has nowhere to send it.

WhereWhatWhen
This machineThe repository, read with git. The report, caches and every run artefact, under ~/.kerno/audit.Always
The model provider, via KernoOne small extract per question: a function body, a single commit's diff, a commit message. Billed to your organization, never used for training.Only with the judge on
KernoMeasurements and monthly series, plus the detail behind them — file paths, commit ids and messages, the author names and emails already in your git history, and the quoted function bodies behind each finding.By default
FlagEffect
--no-evidenceUpload the run, but strip the quoted function bodies from it
--no-uploadMeasure and report locally; send nothing to Kerno
--no-judgeKeep code away from the model; judged measures read unjudged
--localAll of the above at once — nothing leaves this machine
--data-sharingShow the disclosure and choose again

Every upload records how many quoted bodies it stripped, so "the source was removed" is a number rather than a promise. How long an upload is kept and how to have it deleted are in Kerno's privacy policy.

Requirements

  • Node.js 18+
  • Docker: Kerno uses Docker to create isolated environments for test execution. Please ensure Docker Desktop is installed and running on your local machine.
  • Git: Kerno only supports Git repositories. Make sure your project is initialized with Git.

Learn More

Questions? Join the Kerno Discord community.

版本与发布记录

@kerno/cli 共发布 37 个版本,首次发布于 2026/05/05;过去 12 个月发布了 37 个版本。

版本发布日期距今
1.1.1latest2026/11/011 天前
1.1.02026/10/286 天前
1.0.02026/10/1320 天前
0.2.22026/09/251 个月前
0.2.12026/09/221 个月前
0.2.02026/09/111 个月前

关于 @kerno/cli 的常见问题

@kerno/cli 是什么?

Kerno CLI -在编码代理的循环中进行本地运行时后端测试。

如何安装 @kerno/cli?

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

@kerno/cli 支持 TypeScript 吗?

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

@kerno/cli 支持 ESM 还是 CommonJS?

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

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

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

@kerno/cli 可以商用吗?

@kerno/cli 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@kerno/cli 还在维护吗?

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