Skip to content

CLI commands

bash
npx dowse <command> [options]

Common options

Available on most commands.

OptionDefaultDescription
--since <date>12 months agoStart of the git window. Anything git can parse.
--until <date>End of the git window
--complexity <type>locComplexity proxy: loc | cyclomatic | cognitive
--jsonfalseWrite JSON to stdout

analyze

Analyses the workspace, writes .dowse/dowse.json, and prints a summary.

bash
dowse analyze [dir]
OptionDefaultDescription
--top <n>10Number of hotspots to display
--out <path>.dowse/dowse.jsonOutput path
--verify-churn [n]offVerify change frequency of the top N files (default 20) by AST
--min-degree <n>0.3Minimum coupling degree (percentages like 30 also accepted)
--min-shared <n>5Minimum shared commits for coupling

With --json the report goes to stdout and no file is written.


hotspots

Prints just the hotspot ranking.

bash
dowse hotspots [dir] --top 15

coupling

Shows change coupling.

bash
dowse coupling [dir] --hidden
OptionDefaultDescription
--hiddenfalseOnly hidden coupling (co-change with no dependency)
--filesfalseAlso show file-level coupling
--top <n>20Number of rows
--min-degree <n>0.3Minimum degree
--min-shared <n>5Minimum shared commits

Lower the threshold to catch what you are missing

Two very active packages have a large denominator, which drags the degree down. --min-degree 15 often surfaces real pairs.


why

Explains why two things change together.

bash
dowse why <a> <b>

Each target can be a package name, a file path, or a directory — resolved in that order (package name → exact path → prefix match).

OptionDefaultDescription
--cwd <path>.Directory to analyse
--top <n>10Number of file pairs to show
--commits <n>10Number of representative commits
bash
dowse why @acme/admin-web @acme/doctor-web
dowse why packages/ui src/api --since "6 months ago"

health

Shows Code Health and the smell breakdown.

bash
dowse health [dir]
dowse health --file src/foo.ts    # deductions for one file
OptionDefaultDescription
--file <path>Show the breakdown for one file only
--top <n>10Number of rows

knowledge

Shows ownership and bus factor.

bash
dowse knowledge [dir] --top 15

Reports bus factor per package, the contributor list, and an off-boarding simulation showing what would be left unowned if the main developer left.


report

Generates a self-contained single-file HTML report. It makes no external requests and the data is embedded, so you can share the file as-is.

bash
dowse report [dir] --out report.html

diagnose

Diagnoses top hotspots with an LLM (requires Claude Code).

bash
dowse diagnose [dir] --top 3
OptionDefaultDescription
--top <n>3How many to diagnose (cost scales with this)
--model <model>Model to use

An opinion, not a measurement

Keep it separate from the deterministic metrics.


fix

Has an agent fix a hotspot, verifies the result, and measures the complexity delta (requires Claude Code).

bash
dowse fix [target]
dowse fix src/foo.ts --apply
OptionDefaultDescription
--applyfalseKeep verified changes on a working branch
--cwd <path>.Directory to analyse
--top <n>1How many targets when none is named
--max-diff-lines <n>400Maximum accepted diff size
--skip-diagnosisfalseSkip diagnosis and go straight to fixing
--skip-verificationfalseSkip type check and tests (not recommended)
--typecheck-command <script>inferredpackage.json script name for the type check
--test-command <script>inferredpackage.json script name for tests

It is a dry run by default. See Closing the loop for the safety valves.


check

Quality gate. Exits 1 on violation.

bash
dowse check [dir] --min-file-health 3
OptionDescription
--min-file-health <n>Floor for file health
--min-package-health <n>Floor for package health
--max-hotspot <n>Ceiling for hotspot score (0–1)
--min-bus-factor <n>Floor for package bus factor
--max-hidden-coupling <n>Ceiling on hidden coupling count
--sarif <path>Emit SARIF for GitHub Code Scanning

It checks nothing by default

Only thresholds you name explicitly are enforced. Measure where you are first, then start from a level you can actually pass.


diff

Assesses whether changes since a base touched risky ground.

bash
dowse diff <base>
dowse diff origin/main --markdown
OptionDefaultDescription
--head <ref>HEADComparison target
--cwd <path>.Directory to analyse
--markdownfalseWrite PR-comment Markdown to stdout
--out <path>Write the Markdown to a file

mcp

Starts the MCP server over stdio.

bash
dowse mcp [dir] --since "6 months ago"

See Coding agents and the MCP reference.

Released under the MIT License