@aurelienbbn/agentlint

中文文档
0.9.1发布于 2026/10/15MITTypeScriptES Module构建来源已验证近 30 天下载 7834

Deterministic findings and explicit judgment gates for coding agents

原始使用文档
文档目录7 节
  1. Every finding is accepted or it blocks
  2. Install and run the gate
  3. A rule is a code shape plus a standard
  4. Exit codes
  5. What do you want to do?
  6. Public entry points
  7. License

agentlint

CI npm version License: MIT

Your AGENTS.md rules are followed most of the time. agentlint turns the important ones into a gate and keeps a committed record of every exception.

The agentlint review UI: a queue of findings on the left; on the right, a finding that needs a human decision, the standard's checks, the agent's proposal, and the flagged code with Accept and Request changes.

Agents get the mechanical part right and slip on judgment: a payment call without an idempotency key, a dropped column without a backfill, a fallback that hides a failure, an unbounded read that was fine in the fixture.

ToolWith a judgment call
PromptAsks the agent to remember
LinterCan only say "always wrong"
AI reviewerSays something different on every run
Tired humanApproves a big diff because the tests are green
agentlintBlocks until someone records a reason

Every finding is accepted or it blocks

 repository ──▶ deterministic ──▶ finding + your ──▶ acceptance with     ──▶ gate open
 evidence        detector          standard           reason + authority
                                        │
                                        └── no compatible acceptance ──────▶ gate closed
  • Deterministic. Rules match a code shape or a normalized Git change. No model, network, or clock.
  • The standard travels with the finding: text, checks, permitted examples. The agent doesn't rely on recall.
  • Exceptions are reviewable. An acceptance needs a reason and the right authority (agent or human, per rule). It lives in .agentlint/acceptances.jsonl, shows in the PR diff, and expires when the code materially changes: an eslint-disable that needs a reason, an authority, and a new review when the code moves.
  • Humans decide in a keyboard-first local UI or in PR threads, with code, standard, and the agent's proposal side by side.

An open gate means every current finding in the reported scan scope has a compatible recorded decision. It does not prove the judgment was correct, or that unconfigured concerns were reviewed.

agentlint ships no rules and prescribes no agent harness. Your repository and plugin packages own the standards, detectors, and policy.

Install and run the gate

Let your agent do it: the package ships agent skills.

Install @aurelienbbn/agentlint and follow its setup skill
(node_modules/@aurelienbbn/agentlint/skills/agentlint/setup/SKILL.md).

Or by hand:

pnpm add -D @aurelienbbn/agentlint
pnpm agentlint init          # creates .agentlint/config.ts
pnpm agentlint rules test    # replays every rule's fixtures
pnpm agentlint check --all   # the gate

Commit the config, and .agentlint/acceptances.jsonl once it exists. Every command accepts --help.

A rule is a code shape plus a standard

import { defineConfig, defineRule } from "@aurelienbbn/agentlint";

const boundedReads = defineRule({
  lifecycle: "state",
  standard: {
    id: "data/bounded-reads",
    revision: 1,
    title: "Production reads are bounded",
    guidance: { standard: "Reads that scale with production data have an explicit bound or pagination contract." },
  },
  detector: {
    id: "prisma/find-many-without-take",
    version: 1,
    match: { pattern: "$DB.findMany($$$ARGS)", where: { notHas: "take: $_" }, message: "$DB has no explicit bound." },
    fixtures: { mustReport: ["db.users.findMany({})"], mustStaySilent: ["db.users.findMany({ take: 50 })"] },
  },
  binding: { id: "data/bounded-reads", authority: "agent", include: ["src/**/*.ts"] },
});

export default defineConfig({ rules: [boundedReads] });

The standard is revisioned policy, the detector a versioned trigger, and the binding your scope and authority. A change rule judges the Git diff from the merge base instead of the current code.

Exit codes

ExitMeaning
0Every current finding has a compatible acceptance
1One or more findings are unresolved
2Invalid usage, configuration, or evidence; internal error

Every command exits 2, never 1, on an internal error. Local and CI semantics are identical.

What do you want to do?

GoalStart withGuide
Turn a repeated correction into a rulethe rule-advisor skillGet started
Write state and change rulesdefineRuleWrite rules
Close a findingagentlint accept 1 --reason "..."Acceptance
Hand the agent its next findingagentlint next --format jsonAcceptance
Decide as a humanagentlint reviewReview
Calibrate a rule before it gatesagentlint rules scan --reviewCalibration
Gate pull requests and agent turnsthe GitHub action or a Stop hookCI and hooks
Look up a command or flagagentlint --helpCLI reference
Know what the gate guaranteesGuarantees

The required CI check is the real gate; local hooks are feedback. On GitHub:

steps:
  - uses: actions/checkout@v5
    with: { fetch-depth: 0 } # required: change rules use the merge base
  - uses: actions/setup-node@v5
    with: { node-version: 22 }
  - uses: aurelienbobenrieth/agentlint/[email protected]

The full workflow is in the CI guide.

Public entry points

ImportExports
@aurelienbbn/agentlintdefineConfig, defineRule, rule and config types, detector contexts, change evidence and outcome schemas, tagged errors
@aurelienbbn/agentlint/testingPromise-based fixture helpers
@aurelienbbn/agentlint/contractReview wire contract, including NextResult
@aurelienbbn/agentlint/calibrationCalibration report schemas and pure helpers

Every type, schema, and error: Public API.

License

MIT

版本与发布记录

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

版本发布日期距今
0.9.1latest2026/10/1524 天前
0.9.02026/10/1424 天前
0.8.02026/10/1325 天前
0.7.22026/10/1226 天前
0.7.12026/10/1226 天前
0.7.02026/10/071 个月前

关于 @aurelienbbn/agentlint 的常见问题

@aurelienbbn/agentlint 是什么?

Deterministic findings and explicit judgment gates for coding agents

如何安装 @aurelienbbn/agentlint?

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

@aurelienbbn/agentlint 支持 TypeScript 吗?

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

@aurelienbbn/agentlint 支持 ESM 还是 CommonJS?

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

@aurelienbbn/agentlint 需要什么版本的 Node.js?

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

@aurelienbbn/agentlint 可以商用吗?

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

@aurelienbbn/agentlint 的下载量有多少?

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

@aurelienbbn/agentlint 还在维护吗?

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