Skip to content

CLI Reference

Usage

sh
depretec [paths...] [options]

The first positional path sets the project root. Defaults to the current working directory.

File discovery

In a git repo, depretec scans files listed by git ls-files --cached --others --exclude-standard — automatically respecting your .gitignore. Files containing @generated or DO NOT EDIT markers in their header are skipped.

Outside a git repo, depretec falls back to a broad glob with minimal excludes (node_modules, dist, build, *.min.*).

Pass --include to override discovery entirely with your own globs.

Options

FlagShortTypeDefaultDescription
--format-fpretty | json | mdprettyOutput format
--project-pstringauto-detectPath to tsconfig.json
--includeglobExtra glob to include (repeatable)
--excludeglobGlob to exclude (repeatable)
--no-depsbooleanfalseSkip node_modules, scan user source only
--fail-on-foundbooleanfalseExit with code 1 if any occurrence found
--help-hShow help
--version-vShow version

Output formats

--format pretty (default)

Human-readable table printed to stdout.

sh
npx depretec
┌───────────────────┬─────────────────┬───┬─────────────┐
│ Location          │ Deprecated      │ → │ Replacement │
├───────────────────┼─────────────────┼───┼─────────────┤
│ src/schema.ts:3:21│ ZodString.email │ → │ z.email()   │
└───────────────────┴─────────────────┴───┴─────────────┘

--format json

Machine-readable JSON — ideal for piping to LLMs or custom scripts.

sh
npx depretec --format json
json
{
  "occurrences": [
    {
      "file": "src/schema.ts",
      "line": 3,
      "column": 21,
      "deprecation": {
        "qualifiedName": "ZodString.email",
        "replacement": "z.email()"
      }
    }
  ]
}

--format md

Markdown table — paste directly into PR descriptions or GitHub comments.

sh
npx depretec --format md

Examples

sh
# scan current directory
npx depretec

# scan a specific package in a monorepo
npx depretec packages/core

# only your source, skip node_modules types
npx depretec --no-deps

# fail in CI if any deprecated APIs are used
npx depretec --fail-on-found

# output markdown for a PR description
npx depretec --format md >> pr-body.md

# pipe JSON to an LLM
npx depretec --format json | llm -s "Apply these replacements."

# use a non-standard tsconfig
npx depretec --project tsconfig.build.json

Released under the MIT License.