@codacy/verity-cli

中文文档
0.35.3发布于 2026/11/05SEE LICENSE IN LICENSE近 30 天下载 6460

CLI for Verity quality gate service

原始使用文档
文档目录13 节
  1. Install
  2. Where the Standard comes from
  3. Defaults, and how to change them
  4. What init reports
  5. Output
  6. Permission denied?
  7. Upgrade
  8. 0.32.6: the knowledge graph is no longer committed
  9. Coming from GATE.md ( @codacy/gate-cli )?
  10. Quick reference
  11. Skills (Claude Code)
  12. Formal verification (opt-in)
  13. How it works

@codacy/verity-cli

CLI for Verity — a compounding quality system for AI-generated code.

Install

npm install -g @codacy/verity-cli
cd your-project
verity init

verity init is the whole setup. It asks two things, and every other choice is a default that it states in one line:

┌  Verity · acme/payments
◇  Looked at your repository
◇  Verity reviews every turn, every commit and every push
│  To change it, run verity config moments, or just ask Claude.
◇  Hooks here: this project's .claude/settings.json
◇  Signed in as [email protected]                         ← question 1
◇  Profile sent · no source code                        ← question 2
◇  6 rules for this repository · from 500 commits and 2 docs · 14s
◇  Standard v1 saved
└  Ready in 41s.
  1. Sign in. Enter opens GitHub's device page in your browser with the code already on your clipboard. If the Verity GitHub App cannot see the repository, init opens the install page and waits for it. Press s to skip: then only the local security scan runs, because AI review needs sign-in.
  2. Send a repo profile? Only asked when you are signed in and the repository has no Standard yet. The profile holds languages, frameworks and dependency names, folder names, commit subjects with the paths they changed, and CLAUDE.md and AGENTS.md without their code blocks. This step sends no source code, diffs or author names, and Verity does not store the profile. Read it first: init writes it to .verity/repo-profile.json, and v shows it. The service writes review rules for this repository from it. Later, each review sends the code that changed.

When it ends, start a new Claude Code session: Claude Code reads hooks when a session starts. Under the plugin, Verity reviews from your next turn.

Where the Standard comes from

SituationWhat init does
.verity/standard.yaml already existskeeps it, and shares it if the service has none
The service has a Standard for this repouses it, without asking: the team's Standard wins
Neither, and you send the profilethe service writes project rules into v1
Neither, and you do not (or you are not signed in)builds one from Verity's catalogue for your languages

The catalogue Standard is a lookup, not a guess: languages and frameworks are counted and read from your manifests. Add project rules to it later with verity standard generate, or edit .verity/standard.yaml and run verity standard push.

Defaults, and how to change them

DefaultChange it with
Verity reviews every turn, every commit and every pushverity config moments turn,commit,push (any of them, or none), or ask Claude
Static analysis is the Trivy security scan (its database downloads in the background at init)nothing to configure
Formal verification at push is on for a new project; Lean 4 downloads in the backgroundverity config formal off, or VERITY_NO_LEAN=1 before init
Cost & usage telemetry is offverity telemetry install

A re-run keeps what you chose before: the recorded moments, a kept Standard, and anything you set with verity config.

FlagUse
--yesAsk nothing (CI, scripts, agents). Sign-in is skipped unless you are signed in already, and the profile is sent only with --profile send.
--profile send|skipAnswer the profile question without being asked. /verity:init asks in the Claude Code session and passes it down
--no-adoptDon't use the Standard the service holds for this repo: build a new one. Skips the request entirely
--moments <list>Set the moments for this run instead of the default: stop,pre-commit,pre-push, or none
--telemetry on|offTurn cost & usage telemetry on or off (init does not ask)
--untrack-memory · --untrack-stateStop tracking the knowledge graph, or committed Verity state, in git (init does not ask)
--forceOverwrite the installed skills even when they differ
--no-setup · --intensityAccepted and ignored, for old scripts and plugin skills

Press Ctrl-C at any point: every step can run again, so nothing is left half-written. verity setup is an alias for the same command. Run verity doctor any time to see prerequisites, the hook wiring, and what is still missing.

What init reports

Once you are signed in, init sends one small event per step to the Verity service, so that we can see where setup stops. Each event holds the step, how it ended (for the profile step: sent, declined or not asked), and the time since init started. A random id links the steps of one run, and the events are linked to your account. Init sends no repository name, no paths and no machine id.

Before you sign in, nothing is sent. The steps wait in ~/.verity/init-trace.json and go with your next signed-in run. A run that is never followed by a sign-in is never sent, and its entry is dropped after 30 days. Set DO_NOT_TRACK=1 to turn all of this off. It is also off in CI.

Output

Human output goes to stderr; stdout carries only data (--json). The wordmark, the colours and the motion appear only when stderr is a terminal. In CI, in a pipe, or when init runs inside a Claude Code session you get the same results as plain lines: no art, no motion, no escape sequences, and no question that nobody can answer. NO_COLOR and TERM=dumb keep the motion and drop the colour; VERITY_REDUCED_MOTION=1 keeps the colour and drops the motion; VERITY_NO_BROWSER=1 stops sign-in from opening a browser.

Permission denied?

If npm install -g fails with EACCES, your npm global directory needs fixing:

mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc  # or ~/.bashrc
source ~/.zshrc
npm install -g @codacy/verity-cli

Upgrade

npm install -g @codacy/verity-cli@latest

Existing projects keep working — new compound features (knowledge extraction, graph memory, pre-work injection) activate automatically.

0.32.6: the knowledge graph is no longer committed

.verity/memory/ used to be git-tracked. That put Verity's generated notes into every diff and pull request, so teams ended up reviewing the knowledge base in GitHub as if they had written it. New projects now ignore it — the files stay on disk, and for a signed-in project the service syncs them back into any worktree that is missing them.

If you are not signed in, the graph is local-only. Restoring nodes from the service mirror requires an authenticated run, so an anonymous project's graph lives only in its own working tree: it is not committed, and it is not rebuilt elsewhere. That is a deliberate trade — anonymous runs write nothing durable to a shared store — but it means verity memory untrack on an anonymous project leaves you with one copy, on one machine.

Projects that already commit their graph are not changed. A .gitignore rule cannot remove a file that is already tracked, so the switch is offered rather than imposed:

verity memory untrack   # keeps every file on disk, stages their removal from git
verity memory track     # keep committing it on purpose, and stop being asked

verity doctor reports which way your project is set up.

Coming from GATE.md (@codacy/gate-cli)?

GATE.md is now Verity. One-time switch:

npm rm -g @codacy/gate-cli
npm install -g @codacy/verity-cli
verity init   # per project — moves .gate→.verity, keeps your token, Standard & memory

No re-setup needed: your token, Standard, and run history all carry over.

Quick reference

CommandDescription
Core
verity initSet up Verity in this project: two questions (sign in, send a repo profile), the hooks, and the Standard (alias: verity setup)
verity doctorPrerequisites, setup phase, hook wiring, and what is still missing (--json for the machine-readable report)
verity standard synthesizeDerive the Standard from this codebase — no model, no network (--push, --force). Static analysis is Trivy only and needs no config
verity analyzeRun analysis on changed files (stop hook)
verity analyze --mode <mode>Force analysis mode (standard/plan/debug/skip)
verity review --files <paths>On-demand analysis (advisory)
verity statusShow project quality status
verity status --historyShow recent run history with findings summary
verity run <run-id>Show findings for a specific past run; --json for machine-readable output
Auth & Config
verity loginLog in once with GitHub — grants access to every repository you can write to
verity login --forceRe-authenticate and refresh your grants (also how stale grants heal)
verity login --start · --finishThe same login in two steps, for a caller that cannot hold a terminal open (an agent's tool call): --start prints the code as JSON and returns, --finish waits for approval (--wait <s>, default 100) and logs in. --cancel drops a pending code
verity auth registerRegister a single project (per-repo token; superseded by verity login)
verity token create --name <name>Mint a service token for CI (--expires <days> optional)
verity token listList this repository's tokens (ids and metadata only)
verity token revoke <id>Revoke a token by id
verity sessions listList your logins — device, last use, expiry (logins expire after 90 days)
verity sessions revoke <id>Revoke one login by session id
verity logoutSign out on this machine
verity logout --othersSign out every OTHER machine (e.g. a lost laptop)
verity logout --allSign out everywhere, including here
verity hooks installWire Claude Code hooks
verity config moments turn,commit,pushChange WHEN Verity reviews: each turn, each commit, each push (all three by default; none turns them off)
verity hooks install --moments stop,pre-commit,pre-pushThe same, in the hook names (kept for scripts)
verity standard pushUpload project Standard
Knowledge
verity reflectTrigger knowledge extraction for current task
verity reflect --user-input "..."Save a human reflection as a knowledge node
verity reflect --user-input -Same, reading the text from stdin, so it never passes through shell quoting
verity reflect --kind decisionSpecify the node kind
verity memory untrackStop committing .verity/memory/ — the graph stays on disk and leaves your diffs
verity memory trackCommit the graph on purpose, and record that so nothing offers to change it
Formal verification
verity config formal pushTurn it on for this checkout: at push, one risky changed function may get a Lean model, checked and replayed (see below). On by default for a new project
verity config formal offTurn it off
verity lean status / install / removeThe managed Lean 4 toolchain the models are checked with (≈800 MB download, 2.7 GB on disk)
verity prove candidates [paths]Rank the riskiest code from git history and shape signals, no model
verity prove auto [files]Run the push-time phase by hand on the commits ahead of upstream
verity prove waive <file> --reason "…"Dismiss a reproduced counterexample for these exact bytes; it returns if the file changes
Feedback
verity feedback message "text"Send general feedback
verity feedback message -Same, reading the message from stdin
verity feedback finding <run-id> <pattern-id> <action>Per-finding feedback
Tasks
verity task listList tasks
verity task closeClose the current task (triggers extraction)

Skills (Claude Code)

SkillDescription
/verity-setupProposes project-specific custom_patterns from the code (optional; verity init already derives the Standard)
/verity-analyzeOn-demand analysis
/verity-statusProject health dashboard
/verity-feedbackFeedback (general + per-finding)
/verity-learnView and manage project knowledge
/verity-memoryBrowse the knowledge graph
/verity-insightsQuality metrics + Standard evolution
/verity-reflectCapture learnings after a task
/verity-prove <worry>Formal verification on demand: pick a function together, model it in Lean, replay any counterexample on the real code

Formal verification (opt-in)

At git push, beside the review, Verity can build a small Lean 4 model of one risky function in the change, search every interleaving of its actions up to a bound, and, when a property breaks, replay the failing trace on the real code in a disposable container. Only a counterexample that reproduces on the real code can block the push; a model's opinion alone never does.

Most pushes get no formal check. The phase runs only when the push touches a function that looks worth it: history says the file has been fixed before, the text shows a risky shape (check-then-act, retries, money, auth, a transaction, a cache), and a cheap ranking call scores it above the bar. A push of docs, tests or plain code stops in under a second with a named reason. Counterexamples can only be replayed for TypeScript, JavaScript and Python; other languages stop before any model is paid for.

For a new project, verity init turns this on and starts the Lean 4 download in the background (≈800 MB, 2.7 GB on disk; verity lean status shows the progress). Until Lean is ready, a push reports formal: skipped (no-toolchain: Lean installing, 63%) and the gate decision does not change. Init does not start the download in CI (unless VERITY_LEAN=1), with VERITY_NO_LEAN=1, with formal off, or with less than 3.75 GB free. A re-run of init never turns formal on.

verity config formal off      # turn it off for this checkout
verity lean install           # the toolchain, if the background download did not run
verity prove auto             # try it by hand on what is ahead of upstream

The service keeps a structured record of each phase (the function, the model's name, each promise's id and the line number or rule it rests on, each counterexample's trace of action names and its verdict) and never the code, the model, the harness or any prose about them. The full account — what gets selected, the five structural rules, what a replay proves, costs and caps, and what the dashboard shows — is at https://verity.md/docs/formal.

How it works

Prompt → inject knowledge → Agent works → verity analyze → reviewer + knowledge → PASS/FAIL
                                              ↓
                                     extract learnings → .verity/memory/ (graph)
                                              ↓
                                     next prompt starts smarter

The quality gate catches problems. The knowledge system prevents them from recurring. Every analysis run teaches the next one.

Requires Node.js 20+.

版本与发布记录

@codacy/verity-cli 共发布 256 个版本,首次发布于 2026/06/17;过去 12 个月发布了 256 个版本。

版本发布日期距今
0.35.3latest2026/11/055 天前
0.35.3-experimental.f980d82experimental2026/11/027 天前
0.35.22026/10/3010 天前
0.35.12026/10/3010 天前
0.35.1-experimental.19ce23f2026/10/3010 天前
0.35.02026/10/3010 天前

关于 @codacy/verity-cli 的常见问题

@codacy/verity-cli 是什么?

CLI for Verity quality gate service

如何安装 @codacy/verity-cli?

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

@codacy/verity-cli 支持 TypeScript 吗?

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

@codacy/verity-cli 需要什么版本的 Node.js?

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

@codacy/verity-cli 可以商用吗?

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

@codacy/verity-cli 的下载量有多少?

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

@codacy/verity-cli 还在维护吗?

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