Command-Line Help for cofferdam
This document contains the help content for the cofferdam command-line program.
Command Overview:
cofferdam↴cofferdam hello↴cofferdam check↴cofferdam baseline↴cofferdam baseline write↴cofferdam baseline lint↴cofferdam baseline diff↴cofferdam explain↴cofferdam init↴cofferdam doctor↴cofferdam watch↴cofferdam fix↴cofferdam advise↴cofferdam gen-docs↴cofferdam lsp↴
cofferdam
TypeScript code-quality analyzer
Usage: cofferdam <COMMAND>
Subcommands:
hello— Print the project bannercheck— Run all checks against files or directories. With no arguments, walks the current directorybaseline— Manage the baseline of accepted findings. The baseline lets you drop cofferdam into an existing project without immediately failing CI on every pre-existing findingexplain— Print the metadata and prose explanation for one check (built-in or plugin). Use this when a finding's check ID isn't self-explanatory and you want the rationale, default severity, configurable options, and any relevant flags without leaving the terminal. Add--fullto also render the companion markdown body (motivation, examples, config snippets) sourced from the check cataloginit— Scaffold cofferdam.toml + .cofferdam/baseline.json + .gitignore entries so a new project has a workingcofferdam checkafter one command. Refuses to overwrite an existing cofferdam.toml without--forcedoctor— Diagnose install and configuration issues. Reports each check as ✓ / ⚠ / ✗ with a one-line remediation hint on failure. Exit 0 on all-pass, 1 if any check fails. Diagnostic only — never modifies fileswatch— Re-analyze on file change (cd-9hp.4 cp1b). Discovers files once, registers a recursive filesystem watcher, and re-runs the engine on each detected change. A shared in-memory parse cache survives across iterations, so unchanged files skip parse on every subsequent pass. Text output only — for scripted use cases keepcofferdam checkfix— Apply mechanical autofixes for supported checks. Runs the engine against the given paths, groups fixable findings by file, applies edits in reverse byte-offset order, and writes each modified file atomically (write to a temp path then rename). Unsupported checks are silently skipped. Prints a summary to stderradvise— JIT architectural advisory for agents — emit the rules that apply to a given file or directory, INDEPENDENT of whether any current code violates them. Designed for agentic edit loops: an LLM agent shells out before editing a file, gets back layer membership and per-rule constraints, and adjusts its plan before writing code. Static projection — does not parse, does not run checks, does not build the project graph. With no arguments, walks the current directorygen-docs— Regenerate the docs catalog from CheckMeta. Writes per-check markdown files, a schema-stable JSON index, an llms.txt root index, and the CLI reference page (from clap-markdown). Use--checkto fail when the committed files are out of date — same shape ascargo fmt --checklsp— Run the Language Server Protocol server over stdio (cd-9hp.4 cp5). Editors that speak LSP — VS Code (via the bundled extension stub ateditors/vscode), Helix, neovim — connect and receive workspace diagnostics on save. The server hydrates the cp4 disk cache at startup and persists it on shutdown. Run with no arguments; the LSP transport handles its own configuration via the standardinitializerequest
cofferdam hello
Print the project banner
Usage: cofferdam hello
cofferdam check
Run all checks against files or directories. With no arguments, walks the current directory
Usage: cofferdam check [OPTIONS] [PATHS]...
Arguments:
<PATHS>— Files or directories to analyze. Defaults to.
Options:
--hidden— Walk hidden files/directories (default: skip)--no-ignore— Disable.gitignore/.cofferdamignorefiltering--format <FORMAT>— Output format. Default:text. With--robotand no explicit--format, defaults tojsonPossible values:
text: Human-readable text grouped by category (default)json: Machine-readable JSON. Stable schema, no ANSI, no decorative outputcompact: Pipe-delimited line-per-finding format. One header line followed by one record per finding. Most token-economical — use when shovelling findings into an AI promptsarif: SARIF 2.1.0 — OASIS-standard JSON for static-analysis tools. Upload directly to GitHub Code Scanning viagithub/codeql-action/upload-sarif, or feed Azure DevOps, GitLab, SonarQube, the VS Code Sarif Viewer, etc
--robot— Default to a machine-readable format when--formatis not set. Token-economical output for AI agents — pairs with--format=compactfor the smallest output by far--pretty— Pretty-print JSON output (only with--format=json/--robot)--baseline <PATH>— Path to a baseline file. Defaults to.cofferdam/baseline.jsonwhen that file exists. Conflicts with--no-baseline--no-baseline— Disable baseline detection entirely. Equivalent to running without a baseline file present--fail-on-new— Only fail (exit 1) on findings absent from the baseline. Implicit when a baseline is active; pass explicitly to document intent in CI scripts. Has no effect without a baseline--config <PATH>— Path to acofferdam.tomlconfig file. Defaults to walking up from the current directory until one is found or a.gitdirectory is reached. Conflicts with--no-config--no-config— Disable config-file discovery entirely. Equivalent to running without acofferdam.tomlpresent--since <GIT-REF>— PR mode — report only findings on files changed in<git-ref>...HEAD. The full project tree is still analysed for cross-file soundness (OrphanExport, DeadExport, import cycles); only the reported findings are filtered to the diff--fail-on <LEVEL>— Severity threshold for the exit-1 gate. Findings below this level still print; the process only exits 1 if at least one finding is at this level or above. Baselined findings never trigger the gateDefault value:
mediumPossible values:
info,low,medium,high,critical--max-issues <N>— Cap rendered findings at the top N by sort priority. The CI gate (--fail-on) still considers the full unbounded set, so truncating output never hides a failure. Pairs with--quietfor compact CI output.0disables the cap (default)Default value:
0--quiet— Suppress informational output: the trailingN finding(s)summary line, "no TypeScript files found" hints, and the "(showing N of M)" truncation note. Findings, warnings, and errors still print. Has no effect on JSON output (which is already terse)--hide-baselined— Hide baselined findings from text output. The summary line still reports(N new, M baselined)counts so the CI gate remains visible. Has no effect on--format=json(which always includes the per-findingbaselinedflag) or on the--fail-ongate (which already ignores baselined findings). Useful for routine local runs against repos with substantial baselines (cd-k23 / gh #11)--cache-dir <PATH>— Directory for the disk-backed findings/run cache (cd-9hp.4 cp4). Defaults to.cofferdam/cache/under CWD. Eachcofferdambuild writes to a version-scoped subdir so an upgrade invalidates prior caches automatically. Add the directory to.gitignore--no-cache— Disable disk caching entirely. Equivalent to deleting the cache directory before each run. Cold cost only; no correctness difference
cofferdam baseline
Manage the baseline of accepted findings. The baseline lets you drop cofferdam into an existing project without immediately failing CI on every pre-existing finding
Usage: cofferdam baseline <COMMAND>
Subcommands:
write— Run the analyzer and write the current set of findings to the baseline file. Subsequentcofferdam checkruns ignore these findings for CI-gating purposes; they still print as[baselined]so the team can chip away at themlint— Report baseline entries that are also suppressed inlinediff— Compute delta between two baselines
cofferdam baseline write
Run the analyzer and write the current set of findings to the baseline file. Subsequent cofferdam check runs ignore these findings for CI-gating purposes; they still print as [baselined] so the team can chip away at them
Usage: cofferdam baseline write [OPTIONS] [PATHS]...
Arguments:
<PATHS>— Files or directories to analyze. Defaults to.
Options:
--hidden— Walk hidden files/directories (default: skip)--no-ignore— Disable.gitignore/.cofferdamignorefiltering--output <PATH>— Where to write the baseline. Defaults to.cofferdam/baseline.jsonin the current directory--config <PATH>— Path to acofferdam.tomlconfig file. Defaults to walking up from the current directory until one is found or a.gitdirectory is reached. Conflicts with--no-config--no-config— Disable config-file discovery entirely--robot— Machine-readable JSON output. Emits adeltablock when a prior baseline existed; omitted on first run--pretty— Pretty-print JSON output. No effect without--robot
cofferdam baseline lint
Report baseline entries that are also suppressed inline.
A "dual-state" entry is silenced twice — once by the baseline and once by an inline directive — which wastes signal and obscures the true technical-debt posture. Exit 0 if none found, 1 if any (so it is wireable into CI for teams that want to enforce hygiene).
Usage: cofferdam baseline lint [OPTIONS]
Options:
--robot— Machine-readable JSON. Schema:{ dual_state: [...], summary: { count } }--pretty— Pretty-print JSON output. No effect without--robot
cofferdam baseline diff
Compute delta between two baselines.
With two explicit paths: compares them directly. Useful for triage and PR review outside the baseline write path.
Usage: cofferdam baseline diff [OPTIONS] [BASELINE_A] [BASELINE_B]
Arguments:
<BASELINE_A>— First baseline path<BASELINE_B>— Second baseline path
Options:
--robot— Machine-readable JSON--pretty— Pretty-print JSON output. No effect without--robot
cofferdam explain
Print the metadata and prose explanation for one check (built-in or plugin). Use this when a finding's check ID isn't self-explanatory and you want the rationale, default severity, configurable options, and any relevant flags without leaving the terminal. Add --full to also render the companion markdown body (motivation, examples, config snippets) sourced from the check catalog.
Plugin checks: explain discovers plugin-declared checks from cofferdam.toml's plugins = [...] and renders their explanation (and body for --full) the same way as built-ins. Plugins must be loadable from the current working directory; otherwise the unknown-check fallback prints suggestions only from built-ins.
Usage: cofferdam explain [OPTIONS] <CHECK_ID>
Arguments:
<CHECK_ID>— Dotted check ID, e.g.Warning.TripleEquals. If unknown, the CLI prints the closest matches (substring on the ID) or the full list when nothing matches
Options:
--robot— Machine-readable JSON. Schema mirrorsCheckMetafields--pretty— Pretty-print JSON output. No effect without--robot--full— Print the full companion markdown body after the metadata summary. In--robotmode, includes abodyfield in the JSON output. Frontmatter is stripped before display--config <PATH>— Path to acofferdam.tomlconfig file. Defaults to walking up from the current directory until one is found or a.gitdirectory is reached. Conflicts with--no-config--no-config— Disable config-file discovery entirely. Plugin checks won't be resolved
cofferdam init
Scaffold cofferdam.toml + .cofferdam/baseline.json + .gitignore entries so a new project has a working cofferdam check after one command. Refuses to overwrite an existing cofferdam.toml without --force
Usage: cofferdam init [OPTIONS] [PATH]
Arguments:
<PATH>— Project root to initialise. Defaults to the current directoryDefault value:
.
Options:
--force— Overwrite an existing cofferdam.toml--baseline— Capture the current set of findings as the baseline. Skip the interactive prompt--no-baseline— Do not capture a baseline. Skip the interactive prompt--robot— Machine-readable JSON summary instead of human output. No prompts; defaults to capturing a baseline
cofferdam doctor
Diagnose install and configuration issues. Reports each check as ✓ / ⚠ / ✗ with a one-line remediation hint on failure. Exit 0 on all-pass, 1 if any check fails. Diagnostic only — never modifies files
Usage: cofferdam doctor [OPTIONS]
Options:
--robot— Machine-readable JSON output. Schema mirrors the per-check CheckResult and a top-level summary tally--pretty— Pretty-print JSON output. No effect without--robot
cofferdam watch
Re-analyze on file change (cd-9hp.4 cp1b). Discovers files once, registers a recursive filesystem watcher, and re-runs the engine on each detected change. A shared in-memory parse cache survives across iterations, so unchanged files skip parse on every subsequent pass. Text output only — for scripted use cases keep cofferdam check
Usage: cofferdam watch [OPTIONS] [PATHS]...
Arguments:
<PATHS>— Files or directories to watch. Defaults to.
Options:
--hidden— Walk hidden files/directories--no-ignore— Disable.gitignore/.cofferdamignorefiltering--config <PATH>— Path to acofferdam.tomlconfig file. Defaults to walking up from the current directory--no-config— Disable config-file discovery entirely--debounce <MS>— Debounce filesystem events by this many milliseconds. Lower = faster reaction to a save; higher = fewer duplicate runs when an editor emits multiple events per save. 100 ms is the typical sweet spotDefault value:
100
cofferdam fix
Apply mechanical autofixes for supported checks. Runs the engine against the given paths, groups fixable findings by file, applies edits in reverse byte-offset order, and writes each modified file atomically (write to a temp path then rename). Unsupported checks are silently skipped. Prints a summary to stderr
Usage: cofferdam fix [OPTIONS] [PATHS]...
Arguments:
<PATHS>— Files or directories to fix. Defaults to.
Options:
--hidden— Walk hidden files/directories (default: skip)--no-ignore— Disable.gitignore/.cofferdamignorefiltering--dry-run— Preview mode — discover all fixable findings and print what WOULD be changed, but do not modify any file. Exits 0. Use this to audit autofix coverage before committing to a write--robot— Machine-readable JSON output. Emits a structured report instead of human-readable lines. With--dry-run, no files are written; the JSON describes what would change--pretty— Pretty-print JSON output. No effect without--robot
cofferdam advise
JIT architectural advisory for agents — emit the rules that apply to a given file or directory, INDEPENDENT of whether any current code violates them. Designed for agentic edit loops: an LLM agent shells out before editing a file, gets back layer membership and per-rule constraints, and adjusts its plan before writing code. Static projection — does not parse, does not run checks, does not build the project graph. With no arguments, walks the current directory
Usage: cofferdam advise [OPTIONS] [PATHS]...
Arguments:
<PATHS>— Files, directories, or globs to advise on. Defaults to.. Glob patterns (src/**/*.ts) work; shell expansion is honoured first, then the CLI's own globset matcher
Options:
--format <FORMAT>— Output format. Default:text. With--robotand no explicit--format, defaults tojsonPossible values:
text: Human-readable text grouped by file (default)json: Machine-readable JSON array. One object per file
--robot— Default to a machine-readable JSON array when--formatis not set. Token-economical output for AI agents--pretty— Pretty-print JSON output--config <PATH>— Path to acofferdam.tomlconfig file. Defaults to walking up from the current directory until one is found or a.gitdirectory is reached. Conflicts with--no-config--no-config— Disable config-file discovery entirely--hidden— Walk hidden files/directories (default: skip)--no-ignore— Disable.gitignore/.cofferdamignorefiltering--diff <GIT-REF>— Diff mode — run the engine and any configured plugins against the working tree AND the state at<git-ref>, then report rules that WOULD fire if the change were committed (would_fire) plus rules that currently fire on<git-ref>but are cleared by the change (would_clear). Output is always JSON when this flag is set;--formatis ignored--fail-on <LEVEL>— Severity gate for--diffmode. When set, the process exits 1 if anywould_fireentry is at or above this level.would_clearnever gates. No effect without--diffPossible values:
info,low,medium,high,critical
cofferdam gen-docs
Regenerate the docs catalog from CheckMeta. Writes per-check markdown files, a schema-stable JSON index, an llms.txt root index, and the CLI reference page (from clap-markdown). Use --check to fail when the committed files are out of date — same shape as cargo fmt --check
Usage: cofferdam gen-docs [OPTIONS]
Options:
--out <DIR>— Output directory. The catalog lands at<out>/checks.json,<out>/checks/<id>.md,<out>/checks/index.md,<out>/llms.txt,<out>/reference/cli.mdDefault value:
docs--check— Don't write — only fail (exit 1) if the existing files would change. The CI gate uses this
cofferdam lsp
Run the Language Server Protocol server over stdio (cd-9hp.4 cp5). Editors that speak LSP — VS Code (via the bundled extension stub at editors/vscode), Helix, neovim — connect and receive workspace diagnostics on save. The server hydrates the cp4 disk cache at startup and persists it on shutdown. Run with no arguments; the LSP transport handles its own configuration via the standard initialize request
Usage: cofferdam lsp
This document was generated automatically by clap-markdown.