# CLI reference

The commands are documented on their own pages:

- [`outdated`](https://romnn.github.io/cooldown/docs/commands/outdated/)
- [`upgrade`](https://romnn.github.io/cooldown/docs/commands/upgrade/)
- [`fix`](https://romnn.github.io/cooldown/docs/commands/fix/)
- [`check`](https://romnn.github.io/cooldown/docs/commands/check/)
- [the smaller commands](https://romnn.github.io/cooldown/docs/commands/other/)

This page lists the **global flags** they share and the **exit-code** contract. `cooldown --help` prints the authoritative, version-specific list.

Global flags may appear before or after the subcommand: `cooldown --dry-run upgrade` and `cooldown upgrade --dry-run` are equivalent.

[`recover`](https://romnn.github.io/cooldown/docs/commands/other/#recover) is the exception. It takes only these and rejects every other global flag with exit code `2`:

- `--tool` and `--cargo`
- `--no-gitignore`
- `-C, --dir`
- `--json` and `--color`
- `--log-level` and `--no-progress`
- `--no-trace`, `--trace-dir` and `--full-trace`

## Policy and window

| Flag | Effect |
|---|---|
| `--min-age <DUR>` | The cooldown window: `7d`, `2 weeks`, `36h`, ISO-8601 `P7D` (default `7d`). |
| `--min-age-major <DUR>` | Per-kind window for major-version jumps. |
| `--min-age-minor <DUR>` | Per-kind window for minor jumps. |
| `--min-age-patch <DUR>` | Per-kind window for patch jumps. |
| `--latest` | Opt out — window `0` (alias `--no-min-age`). The explicit, audited escape hatch. |
| `--freeze <DATE>` | An absolute cutoff instead of a rolling window — publication-time eligibility is fixed; live registry state (unpublish/yank, npm dist-tags) still applies. |
| `--allow <GLOB>` | Exempt matching packages from the cooldown (repeatable, audited). |

`--min-age`, `--latest`, and `--freeze` are mutually exclusive. Every escape hatch shows up in [`explain`](https://romnn.github.io/cooldown/docs/commands/other/).

## Advisories

The [advisory feed](https://romnn.github.io/cooldown/docs/configuration/advisories/) flags (usually set once in `cooldown.toml` instead):

| Flag | Effect |
|---|---|
| `--advisories` / `--no-advisories` | Enable/disable the OSV advisory feed for this run. |
| `--advisory-min-age <DUR>` | The security window for exact fix versions of a qualifying advisory. Setting it also enables the feed and selects the `shorten` mode. |
| `--advisory-severity <SEV>` | Minimum severity that earns the security window: `low`, `moderate`, `high`, `critical`. Setting it also enables the feed. |

## Scope and selection

| Flag | Effect |
|---|---|
| `--major` | Allow cross-major changes. On by default for `outdated`, off for the mutating commands. |
| `--no-major` | Stay within the current major (alias `--minor`). |
| `--respect-dist-tags` | Cap npm-family candidates at the registry's `latest` dist-tag (the default). |
| `--no-respect-dist-tags` | Adopt npm-family releases above the `latest` dist-tag too. |
| `-p, --package <GLOB>` | Scope the command to matching packages (repeatable). |
| `--tool <TOOL>` | Restrict to tool(s) — `cargo`, `go`, `uv`, … (comma-separated / repeatable; default: all detected). |
| `--cargo` | Only the Rust/Cargo tool — shorthand for `--tool cargo`. |
| `--exclude-folders <GLOB>` | Directories never scanned, `.gitignore`-style (repeatable). |
| `--exclude-packages <GLOB>` | Workspace members dropped from reports by package-name glob (repeatable). |
| `--include-hidden <GLOB>` | Dot-directories scanned after all, `.gitignore`-style (repeatable; `.git` never is). |
| `--no-gitignore` | Don't honor `.gitignore` during project detection. |

See [Exclusions](https://romnn.github.io/cooldown/docs/configuration/excludes/) for the folder, package, and hidden-directory glob semantics.

## Execution and network

| Flag | Effect |
|---|---|
| `--sync` | Sync the policy into native config before `outdated`, `upgrade`, `fix` and `check` (no-op under `--dry-run`). |
| `-n, --dry-run` | Resolve and print the plan; never mutate. `upgrade` and `fix` reject it together with `--offline`, because the preview runs the real resolver. |
| `--offline` | Cache only; a cache miss becomes `unknown-age`, never a false "ok". |
| `--fresh` | Ignore the HTTP cache and Cargo memos; always hit the registry (alias `--no-cache`; use in CI gates). |
| `--no-memo` | Disable Cargo's reuse of rejections and command outcomes for this run while retaining HTTP caching. |
| `--concurrency <N>` | Registry request fan-out width and per-host in-flight cap (default `16`). |
| `--jobs <N>` | How many ecosystems run at once (default: every detected tool in its own lane; `1` runs them one after another). |
| `--allow-stale-lock` | Demote a stale/absent lock to a warning and skip that project's dependency evaluation. |

## Config layers

| Flag | Effect |
|---|---|
| `--config <PATH>` | Load one extra, highest-precedence file layer (still below env / flags). |
| `--no-native` | Ignore the native config layer (reproducibility / debugging). |
| `--no-global` | Ignore the global config layer. |
| `-C, --dir <PATH>` | Run as if from `<path>`. Below the repo root this scopes the run to the workspace member containing it, or the members below it, plus every dependency the tool attributes to no member (so `fix`/`upgrade` under `-C <member>` can move a transitive only a sibling needs), and outranks an `exclude-folders` entry naming it; a directory `.gitignore` hides is an error unless `--no-gitignore` is passed (see [Exclusions](https://romnn.github.io/cooldown/docs/configuration/excludes/)). |

See [Precedence](https://romnn.github.io/cooldown/docs/configuration/precedence/) for how the layers combine.

## Output and presentation

| Flag | Effect |
|---|---|
| `--json` | Machine-readable output (never changes the exit code). |
| `--color <WHEN>` | `auto` (TTY + `NO_COLOR` unset), `always`, or `never`. |
| `--log-level <LEVEL>` | Diagnostic log on stderr: `off`, `error`, `warn`, `info`, `debug`, `trace` (`RUST_LOG` overrides). |
| `--no-progress` | Suppress the human-facing progress display (alias `--quiet`). |
| `--list-packages` | List every source package on its own line instead of `first (+N others)`. |
| `--paths` | Show the **Used by** column as workspace paths instead of package names. |
| `--show-projects` | Add a **Project** column attributing each row to its project. |
| `--no-suggestions` | Suppress actionable tips (the reports and their counts are unaffected). |
| `--no-trace` | Do not record the diagnostic [run trace](https://romnn.github.io/cooldown/docs/traces/) of `upgrade`, `fix`, and `outdated`. |
| `--trace-dir <PATH>` | Store run traces in this directory instead of the user configuration directory. |
| `--full-trace` | Record the run trace in full instead of the compact default. |

## Environment variables

Several flags mirror an environment variable, so CI can set policy once:

| Variable | Equivalent |
|---|---|
| `COOLDOWN_MIN_AGE` | `--min-age` |
| `COOLDOWN_MIN_AGE_MAJOR` | `--min-age-major` |
| `COOLDOWN_MIN_AGE_MINOR` | `--min-age-minor` |
| `COOLDOWN_MIN_AGE_PATCH` | `--min-age-patch` |
| `COOLDOWN_LATEST` | `--latest` (set to `1`, `true`, `yes` or `on`) |
| `COOLDOWN_FREEZE` | `--freeze` |
| `COOLDOWN_ALLOW` | `--allow` (comma-separated globs) |
| `COOLDOWN_TOOL` | `--tool` |
| `COOLDOWN_CONFIG` | `--config` |
| `COOLDOWN_DRY_RUN` | `--dry-run` |
| `COOLDOWN_OFFLINE` | `--offline` |
| `COOLDOWN_NO_MEMO` | `--no-memo` |
| `COOLDOWN_CONCURRENCY` | `--concurrency` |
| `COOLDOWN_JOBS` | `--jobs` |
| `COOLDOWN_ALLOW_STALE_LOCK` | `--allow-stale-lock` |
| `COOLDOWN_ADVISORIES` | `--advisories` / `--no-advisories` |
| `COOLDOWN_ADVISORY_MIN_AGE` | `--advisory-min-age` |
| `COOLDOWN_ADVISORY_SEVERITY` | `--advisory-severity` |
| `COOLDOWN_LOG` | `--log-level` |
| `COOLDOWN_NO_TRACE` | `--no-trace` |
| `COOLDOWN_TRACE_DIR` | `--trace-dir` |
| `COOLDOWN_FULL_TRACE` | `--full-trace` |
| `RUST_LOG` | overrides `--log-level` |
| `NO_COLOR` | a non-empty value turns off color under `--color auto` |

Two variables have no flag:

- `COOLDOWN_LOCK_WAIT`: how long to wait for a project lock another `cooldown` run holds, as a duration such as `30s` (default `10m`). `0` or `none` fails at once; a value that does not parse keeps the default.
- `COOLDOWN_<BIN>`: runs a different program in place of a package manager, see [Which binary runs](https://romnn.github.io/cooldown/docs/tools/#which-binary-runs).

A `COOLDOWN_*` environment layer also feeds config values; it sits above the file cascade and below CLI flags in [precedence](https://romnn.github.io/cooldown/docs/configuration/precedence/).

## Exit codes

`check` is the CI gate, so a non-zero exit is its contract:

| Code | Meaning |
|---|---|
| `0` | Clean / nothing to do. |
| `1` | Policy violation (`check`), or an incomplete mutation under `upgrade` / `fix --strict`. |
| `2` | Usage / config error (bad duration, unknown `--tool`, mutually-exclusive flags, …), a tripped `check --fail-on-stricter-native` or `strict-native`, or `init` refusing to overwrite an existing `cooldown.toml`. |
| `3` | No tool detected. |
| `4` | Stale/absent lock, registry unreachable, a tool failed, or unknown-age under a flag. |
| `N` | `outdated --exit-code[=N]` found adoptable updates. |
| `130` | Interrupted by a signal (`SIGINT`, `SIGTERM`, `SIGHUP`). The first signal stops the package manager and rolls back the trial in progress; a second quits at once, without finishing the rollback. |
