The engine · command line

CodeDelta at the command line

One tool, two front doors. The GUI is CodeDelta for a person at a desk. The command line is the same engine for scripts, cron jobs and other systems — same scans, same reports, no window.

One tool, two front doors

Everything the GUI does, the command line does — they run the same engine and write the same reports. Use the GUI to explore; use the command line when the scan should happen on its own: nightly, weekly, on a build server, or inside a quality system you already run. Nothing about the results changes with the door you came in through.

The CodeDelta desktop app — analysis modes, demos, and the results panel
The other front door. The desktop app — same engine, same scans, same reports, chosen from a panel instead of a flag.

A scan in one line

The bundle gives you two commands. codedelta is the engine: give it two versions of the code and it writes the churn reports. codedelta-gui scan runs that same engine and can add the rest — the AI scans, the pass/fail gates and the trend database. One thing to watch: the engine takes the OLD directory first, the batch command takes the NEW one first.

# the engine: OLD first, NEW second ./codedelta release-1.0/ release-1.1/ -o report.html # the batch CLI: NEW first, OLD second (add --mode for the other scans) ./codedelta-gui scan release-1.1/ release-1.0/ --mode churn_agent

Out come the churn report, the project overview (the PM-friendly page) and the Code Browser — plus CSV, JSON and XML unless you ask for fewer (--html --csv --json --xml pick formats; none given means all).

CodeDelta churn report — 1,000 files, 170 changed, REP_CHURN 0.46
The churn report. 1,000 files, 170 changed — per-file CHG / DEL / ADD across SLOC & LLOC, with REP_CHURN at 0.46.
Code Browser — Overview tab on a two-release comparison: changed files ranked with one-line stories, then the project structure
The Code Browser. The same scan also writes the interactive page: changed files ranked with one-line stories, the diff, the tree, the classes.

The six modes

The same choices the GUI offers, under one flag.

--modeWhat runs
churnChurn only — the default when you give two versions.
churn_agentChurn + Agent Scan, no ML — the GitHub Action’s default.
agentAgent Scan only.
aiAI code audit only.
ai_auditAI audit + Agent Scan on a single project — the default when you give one directory.
bothEverything: churn + AI audit + Agent Scan.

The weekly loop

The longest-standing deployment pattern for this engine — running for years inside an enterprise quality system: a scheduled scan, a growing database, and the outputs feeding the customer’s own tooling.

# crontab: every Monday 06:00 — scan, append to the trend database 0 6 * * 1 /opt/codedelta/codedelta-gui scan /repo/current /repo/last --mode churn_agent --db /var/codedelta/trend.db --quiet # then: the executive summary, from the same database /opt/codedelta/codedelta-gui trend /var/codedelta/trend.db --out weekly-trend.html

Add --fail-on-critical, --fail-on-ai N or --gate and the exit code (3) becomes your alert; add --baseline/--fail-on-new and only regressions fire it.

The trend database

Pass --db and every scan appends to one ordinary SQLite file. Four tables do the work: projectrunfile_metrics (every file’s size, comments and churn, per run) and run_totals (the roll-up). Nothing proprietary — any SQLite client, ORM or BI tool can read it, which is how the output feeds a quality system you already own.

# the ten most-churned files across the whole history sqlite3 trend.db "SELECT rel_path, SUM(crn_lloc) AS churn FROM file_metrics GROUP BY rel_path ORDER BY churn DESC LIMIT 10;"

Or skip the SQL: codedelta-gui trend trend.db --out trend.html turns the same history into the executive summary — headline numbers, arrows against the previous run, churn and AI% charted across runs.

Isn’t cloc a churn tool?

No — and the distinction matters. cloc is a line counter, and a fine one: point it at a directory and it tells you how many lines of code, comments and blanks are there, per language. It also has a --diff mode that compares two directories and reports lines added, removed and modified — and because that output looks like churn, teams quote it as churn. That’s the trap. It’s comparing raw text lines, not statements: reformat a file and it counts change where nothing changed.

CodeDelta’s second pass parses the code into logical statements — the unit every churn figure uses — so a re-wrapped line isn’t change, but an edited statement is. Data files such as JSON are measured separately and never enter the churn totals. And the TRUE_CHURN measurement goes further still: machine-generated content — lockfiles, generated bindings — is identified by rule and set aside, with each excluded file named, so the subtraction is checkable. On one npm/cli release, 80.1% of the apparent churn came from a single generated file. What remains is the churn a person actually wrote.

We ran both tools over six and a half years of Erlang/OTP on identical commit hashes. cloc’s diff aborted on three of seven windows and silently skipped 4,046 files, with no coverage line to say so. CodeDelta’s churn measurement — logical statements changed, deleted, added and moved — is a different instrument answering a different question, and it accounts for every file in the tree: measured, counted as text, or named as set aside (images, compiled binaries). Nothing is silently dropped. The full side-by-side, with per-window output: cloc vs CodeDelta and the Erlang/OTP measurement.

What comes out

HTML reports

The churn report, the project overview and the Code Browser — self-contained files you can archive or serve.

CSV

Every metric per file — the integration point for spreadsheets, dashboards and your own quality system.

JSON & XML

Raw audit and agent findings as JSON; engine metrics as EPM-compatible XML for systems that already read it.

SQLite database

--db appends every run; the trend command turns the history into an executive summary with charts.

AI Bill of Materials

--bom writes the AI-BOM (native or CycloneDX) — which providers your code calls and where the data would go.

Exit codes

0 clean · 3 gate or threshold breached — the one-line contract that lets any scheduler or CI treat a scan as pass/fail.

CodeDelta CSV output — fmt 10.2.1 to 11.1.4, one row per file: SLOC, LLOC, CHG/DEL/ADD/MOV across SLOC and LLOC, REP_CHURN and REWORK per file
The CSV. fmt 10.2.1 → 11.1.4, most-churned files first: one row per file, every metric a column — CHG / DEL / ADD / MOV across SLOC and LLOC, REP_CHURN and REWORK computed per file.
CodeDelta XML output — project totals then per-file items, EPM-compatible format
The XML. The same scan as EPM-compatible XML: project totals first, then every file with its metrics — for quality systems that already read this format.
Licensing: set CODEDELTA_LICENSE in the environment or put codedelta.lic next to the binary. The public evaluation licence from the download page works at the command line too.

Get the engine

The command line ships in every bundle — macOS, Linux and Windows, free to evaluate. Running it in GitHub, Docker, Jenkins or another CI instead? That’s the CLI / CI page.