@adlc/spec-lint

中文文档
1.12.0发布于 2026/10/10MITES Module构建来源已验证近 30 天下载 8172

Audits a spec for acceptance criteria that lack a concrete verification method (C1/P1).

原始使用文档
文档目录10 节
  1. Usage
  2. Flags
  3. Exit codes
  4. What counts as a verification method?
  5. Where criteria are found
  6. LLM demotion (--llm)
  7. JSON output
  8. Example
  9. Relationship to sibling tools
  10. Core gaps

spec-lint

ADLC phase: C1 (P1 gate)

Audits a spec for acceptance criteria that lack a concrete verification method. Every acceptance criterion must name how it will be checked — a test file, a command whose output is asserted, an explicit verify: label, an assert statement, or an exit code reference. Criteria without one are wishes. Wishes get flagged at exit 2, blocking CI until the spec is tightened.

Usage

spec-lint <spec.md> [--llm] [--json] [--prompt-only] [--record --ticket <id>]

Flags

FlagDescription
--llmRun a cheap-tier LLM pass on VERIFIED criteria to catch vacuous methods ("works correctly", "run tests"). Demoted criteria become WISH. Requires a provider env var (see core).
--jsonEmit machine-readable JSON (for orchestrators). All other output is suppressed.
--prompt-onlyPrint the exact LLM prompt and exit 0. Works with zero API keys — paste into any harness.
--recordOn a passing run, record a spec-lint entry into .adlc/manifest.jsonl via gate-manifest, hashing <spec.md> into it. Requires --ticket — an unbound record could satisfy another ticket's P1 gate. Never records on a failing (WISH-containing) run.
--ticket <id>Ticket to bind the recorded entry to (required with --record).

Exit codes

CodeMeaning
0Gate passes — every acceptance criterion names a verification method.
1Operational error — file missing, unreadable, or LLM call failed.
2Gate fails — one or more criteria are wishes (line numbers printed), or the spec states no acceptance criteria at all.

What counts as a verification method?

A criterion is VERIFIED if its text contains any of:

  • A backtick span that looks like a command or assertion: `npm test`, `curl -s ... | jq .`, `stripe-test --card=valid`, or a bare span immediately preceded by phrasing like "Verified via" / "Run ". A bare backtick span with no command-like content (e.g. a filename mentioned in passing, `vitest.config.ts`) is not sufficient on its own.
  • A path matching *.test.<ext> or *.spec.<ext>: auth.spec.ts
  • verify: or verified by followed by text
  • test: followed by text
  • The phrase exit code
  • The word assert

Everything else is a WISH.

Where criteria are found

Criteria are extracted from:

  1. List items (-, *, 1., - [ ], - [x]) under any heading matching /acceptance|criteria|requirements|definition of done|success/i — this includes a literal markdown heading (## Acceptance Criteria) or a bold-only pseudo-heading line (**Acceptance criteria**:). A list item's wrapped continuation lines (indented, non-blank, not themselves a new list marker/heading) are joined into the same logical criterion before classification, matching how markdown renderers treat a single list item.
  2. Standalone lines starting with MUST or SHOULD (anywhere in the file)

LLM demotion (--llm)

Even VERIFIED criteria can be vacuous. "Run tests and verify it works correctly" contains a backtick command but conveys nothing checkable. The --llm flag sends VERIFIED criteria to a cheap model asking it to identify vacuous methods and returns a { vacuous: [indices], reason: {...} } JSON object. Vacuous criteria are demoted to WISH.

Use --prompt-only to get the exact prompt without making any API calls — useful for testing, auditing, or pasting into a different model.

JSON output

{
  "file": "spec.md",
  "total": 5,
  "verified": 3,
  "wishes": 2,
  "criteria": [
    { "line": 8, "status": "VERIFIED", "text": "...", "reason": "..." },
    { "line": 9, "status": "WISH",     "text": "...", "reason": "no verification method found" }
  ]
}

Example

# Run gate — exit 2 if any wishes
spec-lint docs/spec.md

# Machine-readable for CI
spec-lint docs/spec.md --json

# Inspect LLM prompt without API key
spec-lint docs/spec.md --prompt-only

# Full LLM-backed demotion pass
ANTHROPIC_API_KEY=sk-... spec-lint docs/spec.md --llm

Relationship to sibling tools

  • C2 premortem — after spec-lint passes, stress-test the approved spec with a frontier model (postmortem framing).
  • C3 coldstart — per-ticket gap analysis; spec-lint gates the spec, coldstart gates individual tickets.
  • C11 gate-manifest — spec-lint results should be appended to the manifest ledger after a gate run.

Core gaps

None. All required functionality (complete, extractJson, parseArgs, pass, gateFail, opError, printJson, promptOnly) is present in core.

版本与发布记录

@adlc/spec-lint 共发布 18 个版本,首次发布于 2026/06/14;过去 12 个月发布了 18 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.12.0latest2026/10/1027 天前
1.11.12026/09/091 个月前
1.11.02026/08/252 个月前
1.10.02026/08/112 个月前
1.9.02026/08/092 个月前
1.8.02026/08/082 个月前

关于 @adlc/spec-lint 的常见问题

@adlc/spec-lint 是什么?

Audits a spec for acceptance criteria that lack a concrete verification method (C1/P1).

如何安装 @adlc/spec-lint?

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

@adlc/spec-lint 支持 TypeScript 吗?

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

@adlc/spec-lint 支持 ESM 还是 CommonJS?

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

@adlc/spec-lint 需要什么版本的 Node.js?

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

@adlc/spec-lint 可以商用吗?

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

@adlc/spec-lint 的下载量有多少?

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

@adlc/spec-lint 还在维护吗?

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