CppDepend AI
Commands
cppdepend-ai stands for the program in your CppDepend folder. Your assistant runs most of these commands for you, you can also run them yourself.
| Command | What it does |
|---|---|
analyze |
analyzes your code and prepares the results for your assistant |
diff |
what your change introduced (new issues, new and changed methods) |
review |
a ready-to-post review of a change: new issues + quality gate |
explain |
everything about one class, namespace or method |
query |
ask CppDepend any question (CQLinq) |
gate |
check the quality gate: pass or fail |
status |
are the results up to date? |
init |
prepare a repository for your assistant |
Options available everywhere:
| Option | Meaning |
|---|---|
--project <file.cdproj> |
the CppDepend project to use. Optional when there is a single .cdproj in the current folder or above |
--quiet |
print less |
--verbose |
print more (useful when something goes wrong) |
--version |
print the version |
analyze
cppdepend-ai analyze --run --project MyApp.cdproj
| Option | Meaning |
|---|---|
--run |
run a new analysis first. It is incremental when a previous analysis exists (faster), full otherwise. Without --run, the latest analysis is reused and the command is instant |
--full |
together with --run: force a full analysis |
--out <folder> |
where to write the results. Default: the cppdependai folder inside the output folder of your CppDepend project |
--gate <file> |
quality gate file (default: cppdepend-ai.gate.json when present) |
--top-methods N |
how many of the most complex methods to include (default 1000) |
--churn-days N |
how many days of git history count for hotspots (default 90) |
analyze does not build your code: build first.
diff
cppdepend-ai diff [--base main] [--run]
New issues, fixed issues, added and removed types, added and changed methods, compared with the baseline of your project. --base main keeps only what is in files changed since main (ideal for a pull request).
review
cppdepend-ai review --base main
A ready-to-use review of your change: the new issues in the changed files and the quality gate verdict, written as a short report (review.md in the cppdependai folder) that you can paste or post on a pull request. See Review.
explain
cppdepend-ai explain "MyNs::MyClass"
Where it is, its metrics, who calls it, what it calls, its issues. Works for a namespace, a type or a method. Put the name in quotes. If the name is ambiguous you get a list: repeat with a more complete name.
query
cppdepend-ai query "from m in Application.Methods where m.CyclomaticComplexity > 30 orderby m.CyclomaticComplexity descending select new { m, m.CyclomaticComplexity }"
Runs any CQLinq query, rule or quality gate on the latest analysis, the same language as in CppDepend. Options: --file <query.cql>, --max-rows N (default 100), --timeout seconds (default 30).
Several queries in one call
Loading the project takes time. If you have several queries, run them in one call:
cppdepend-ai query --file complexity.cql --file cycles.cql
cppdepend-ai query --queries-dir ./queries
cppdepend-ai query --batch queries.json
| Option | Meaning |
|---|---|
--file <f> |
a query file, can be repeated |
--queries-dir <dir> |
every *.cql file of the folder |
--batch <f> |
a file listing the queries: either JSON (["query 1", { "id": "x", "query": "...", "maxRows": 20 }]) or text with queries separated by a line ---. Use - to read from the keyboard or a pipe |
If one query fails, the others still run.
gate
cppdepend-ai gate
Checks your quality gate against the latest analysis. Prints the result and fails (see exit codes) when quality got worse.
status
cppdepend-ai status
Tells you instantly whether the results are up to date. If not, it says why and what to run.
init
cppdepend-ai init
Prepares the repository for your assistant: instructions in AGENTS.md, CLAUDE.md, a quality gate file and a few assistant files. Existing files are kept unless you add --force.
| Option | Meaning |
|---|---|
--dir <folder> |
the repository folder (default: current folder) |
--agents cursor,copilot,gemini or all |
also create the files of these assistants (Codex and most others only need AGENTS.md, Claude Code only needs the default files). See Quick start |
--ci github |
also create a GitHub workflow that reviews every pull request (Review) |
--force |
overwrite existing files |
