Running in CI
By the end of this page you will have a short script that fails a CI job when claudevs check
fails, names the stage that failed, and optionally treats manifest warnings as failures.
Use JSON in CI
--json replaces the human report with a JSON document on stdout. Its one top-level key is stages,
an array with one entry per stage. Each entry has a name, a status and a detail.
$ claudevs check --json crates/claudevs/examples/07_wiring_broken | jq '.stages[] | select(.name == "wiring")'
{
"name": "wiring",
"status": "failed",
"detail": " error refs hooks/hooks.json:9 `${CLAUDE_PLUGIN_ROOT}/hooks/format-on-write.sh` does not exist\n\n1 error, 0 warnings\n"
}
status is "passed", "failed" or "skipped". detail is the same text the human report shows
for that stage. It is a string, not a further layer of JSON.
The report carries no verdict of its own. The verdict is the exit code of claudevs check.
| Exit code | Meaning |
|---|---|
| 0 | No stage failed. A skipped stage does not count against the run. |
| 1 | At least one stage failed. |
| 2 | claudevs could not run the check, for example because the path is not a directory. |
$ claudevs check --json no-such-dir; echo "exit $?"
claudevs: walk plugin `no-such-dir`: No such file or directory (os error 2)
exit 2
The exit code is easy to lose. In a pipeline, the shell reports the last command's status, and that
is jq's:
$ claudevs check --json crates/claudevs/examples/07_wiring_broken | jq -r '.stages[] | select(.status == "failed") | .name'; echo "exit $?"
wiring
exit 0
claudevs exited 1 there and the pipeline still reported 0. Either run the shell with
set -o pipefail so a failing command anywhere in the pipeline fails it, or keep the report in a file
and carry the exit code yourself. This is the second way, saved as ci-gate.sh:
claudevs check --json crates/claudevs/examples/07_wiring_broken > report.json
status=$?
jq -r '.stages[] | select(.status == "failed") | .name' report.json
exit "$status"
$ bash ci-gate.sh; echo "exit $?"
wiring
exit 1
The script prints the name of every failed stage and exits with claudevs's own code. In your own
job, point it at your plugin instead of the example.
Fail on manifest warnings
By default the validate stage is lenient. A warning from claude plugin validate, such as a
manifest with no author, is shown and the stage still passes. Pass --strict to make the same
warning fail the stage, for callers who want warnings to gate a release.
To see the difference, copy the 01_hook_decision example to a scratch directory and delete the
author line from the copy's .claude-plugin/plugin.json. Remove the comma after the line above it
too, so the file is still valid JSON.
$ cp -R crates/claudevs/examples/01_hook_decision /tmp/no-author
$ claudevs check --json /tmp/no-author > report.json; echo "exit $?"
exit 0
$ jq -c '.stages[] | {name, status}' report.json
{"name":"validate","status":"passed"}
{"name":"wiring","status":"passed"}
{"name":"test","status":"passed"}
{"name":"test --installed","status":"skipped"}
The same plugin with --strict:
$ claudevs check --strict --json /tmp/no-author > report.json; echo "exit $?"
exit 1
$ jq -c '.stages[] | {name, status}' report.json
{"name":"validate","status":"failed"}
{"name":"wiring","status":"passed"}
{"name":"test","status":"passed"}
{"name":"test --installed","status":"skipped"}
$ jq -r '.stages[0].detail | rtrimstr("\n") | split("\n") | last' report.json
✘ Validation failed (--strict treats warnings as errors)
--strict changes only the validate stage. The other three stages report the same as before.
test --installed is skipped in both runs because the copy in /tmp has no marketplace manifest
above it. The flag also changes nothing when claude is not on PATH, because the stage is skipped
before it could be strict.
Skips are also covered in Selecting Cases and Reading Skips. The whole command line is in the claudevs CLI reference.