Skip to content

cofferdam doctor

cofferdam doctor is a one-stop diagnostic command for your cofferdam installation and project configuration. Run it on a fresh checkout, after upgrading cofferdam, or whenever something feels off. It never edits files — it only inspects and reports.

Usage

bash
cofferdam doctor
cofferdam doctor --robot
cofferdam doctor --robot --pretty
FlagEffect
--robotEmit a single-line JSON object instead of human-readable output
--prettyPretty-print JSON (only with --robot)

Checks

Doctor runs 7 checks in sequence and reports every result before exiting. All 7 always run — there is no early exit on first failure, so you see the complete picture in one shot.

binary-integrity

Verifies that the running binary's compiled-in version (env!("CARGO_PKG_VERSION")) matches what cofferdam --version reports at runtime. Passes when both agree. Fails when they differ, which can happen after a partial upgrade where the new binary wasn't written atomically.

StatusCondition
PassVersions match
FailVersions differ, or the executable cannot exec itself

Remediation: re-install @cofferdam/cofferdam


config

Searches for cofferdam.toml by walking up from the current directory to the nearest .git root (the same walk cofferdam check uses). Reports whether the file exists, whether it parses cleanly, and whether it references any unknown check IDs.

StatusCondition
PassNo cofferdam.toml found (defaults in effect), or file found and parses cleanly
WarnFile parses but contains one or more unknown check IDs
FailFile exists but has a syntax error

Remediation for Warn: remove the unknown key(s) or upgrade cofferdam Remediation for Fail: fix the syntax error in <path>


baseline

Looks for .cofferdam/baseline.json by walking up from the current directory. If found, reads and parses it. Additionally checks that every file path referenced by a baselined entry still exists on disk (stale paths indicate the baseline needs refreshing after files were renamed or deleted).

StatusCondition
PassNo baseline file found, or file loads cleanly with no stale entries
WarnBaseline is valid but references one or more files no longer in the repo
FailFile exists but cannot be read or parsed (schema mismatch, JSON error)

Remediation for Warn or Fail: cofferdam baseline write


git

Checks that git --version exits successfully and that the current working directory is inside a git repository (git rev-parse --show-toplevel). Git is required for --since (PR-only mode) and CI integrations that gate on changed files.

StatusCondition
Passgit found on PATH and cwd is inside a repo
Warngit found but cwd is not inside a repo
Failgit not found on PATH

Remediation for Fail: install git for --since and CI integration Remediation for Warn: run cofferdam from inside a git checkout if you need --since


discovery

Runs the default discovery pass against . (the same walk cofferdam check uses with no explicit paths). Reports how many TypeScript files were found.

StatusCondition
PassOne or more TypeScript files found, or zero files but [discovery] is configured in cofferdam.toml
WarnNo TypeScript files found and no explicit scope is configured

Remediation: scope cofferdam by passing paths or configuring [discovery] in cofferdam.toml


suppression-directives

Discovers all .ts/.tsx files (same walk as discovery), then scans each file for // cofferdam-disable-next-line and /* cofferdam-disable */ directives that name specific check IDs. Validates every named ID against the current all_builtins() registry. This catches stale directives left over after a check was renamed or removed.

If more than 1000 files are found, the scan is skipped with a warning (use --paths to narrow scope and then re-run).

StatusCondition
PassAll named directive IDs are known
WarnOne or more directive IDs reference unknown checks, or >1000 files (scan skipped)

Remediation: rename to a current check ID or remove the directive — see cofferdam explain --list


wrapper-version

Only meaningful when cofferdam is installed via npm. Detects whether a packages/cofferdam/package.json file is present up the path from the current executable (which indicates a source-tree install or an npm-installed binary). Compares the npm package version field against the compiled binary version.

If no packages/cofferdam/package.json is found, the check is skipped — it does not apply to direct binary installs.

StatusCondition
PassVersions match, or no npm package found (skipped)
Warnnpm package and binary version differ
SkippedNot an npm install

Remediation for Warn: re-run npm install @cofferdam/cofferdam (for npm users). Version drift in a source-tree checkout is intentional pre-1.0 behaviour.


Exit codes

CodeMeaning
0All checks passed (including warns and skips)
1One or more checks failed

Warnings do not cause a non-zero exit. Only Fail-status checks trigger exit code 1. This is intentional — pre-flight friendliness means CI can include cofferdam doctor as an informational step without making the build brittle.

JSON schema (--robot)

The --robot flag emits a single JSON object on one line (or pretty-printed with --pretty). The schema is additive-only across versions: fields will not be renamed or removed; new fields may be added.

Example (pretty-printed):

json
{
  "results": [
    {
      "name": "binary-integrity",
      "status": "pass",
      "message": "0.1.4 (matches build)",
      "remediation": null
    },
    {
      "name": "config",
      "status": "warn",
      "message": "cofferdam.toml at /repo/cofferdam.toml — unknown check id(s): Bogus.Whatever",
      "remediation": "remove the unknown key(s) or upgrade cofferdam"
    }
  ],
  "summary": {
    "pass": 6,
    "warn": 1,
    "fail": 0,
    "skipped": 0
  }
}

Field reference:

FieldTypeValues
results[].namestringCheck identifier (stable across versions)
results[].statusstring"pass", "warn", "fail", "skipped"
results[].messagestringHuman-readable one-line summary
results[].remediationstring or nullRemediation hint; null when status is pass/skipped
summary.passintegerCount of passing checks
summary.warnintegerCount of warning checks
summary.failintegerCount of failing checks
summary.skippedintegerCount of skipped checks

MIT License