Skip to content

Repository files navigation

dmint

Download a Mintlify docs site as a local directory of Markdown files.

"dmint" = download Mintlify. Point it at any Mintlify-hosted docs site and it mirrors every page as plain Markdown, preserving the site's URL structure as a local directory tree. Useful for backing up docs, tracking content changes over time in git, and giving AI agents (like Claude Code) a complete local copy of a docs site to search and read.

Install

With Bun installed:

bun install -g @mkdnsite/dmint
# or, if you prefer npm as the installer (Bun is still required at runtime)
npm install -g @mkdnsite/dmint

The npm package is scoped (npm considers the bare name dmint too similar to existing packages), but the installed command is plain dmint.

The npm package runs the TypeScript source directly on Bun, so Bun >= 1.2 must be on your PATH.

No Bun? Use a standalone binary (Bun runtime included) from the latest release, or Homebrew:

brew install mkdnsite/tap/dmint

Every release binary carries a signed build-provenance attestation. Verify one with:

gh attestation verify dmint-darwin-arm64 --repo mkdnsite/dmint

Usage

Usage: dmint <url> [dir] [options]

Arguments:
  <url>  Base URL of the Mintlify docs site, e.g. https://docs.example.com  [required] [string]
  [dir]  Output directory, created if missing (default: current directory)                [dir]

Options:
  -c, --concurrency <n>  Concurrent page downloads                        [number] [default: 8]
  -p, --prune            Delete local .md files that are no longer in the sitemap     [boolean]
  -y, --yes              Skip confirmation prompts (assume yes)                       [boolean]
  -n, --dry-run          Show what would be downloaded or deleted without writing     [boolean]
  -q, --quiet            Only print errors and the final summary                      [boolean]
  -h, --help             Show help                                                    [boolean]
  -v, --version          Show version number                                          [boolean]

Download a docs site

mkdir acme-docs && cd acme-docs
dmint https://docs.acme.com
# ✓ index.md
# ✓ introduction.md
# ✓ guides/quickstart.md
# ...
# ✓ llms.txt
# ✓ sitemap.xml
# Downloaded 82 of 82 pages + llms.txt + sitemap.xml to . in 6.1s

Track docs changes over time with git

mkdir acme-docs && cd acme-docs && git init
dmint https://docs.acme.com --quiet
git add -A && git commit -m "docs snapshot $(date +%F)"

# ...later: re-run and see exactly what changed
dmint https://docs.acme.com --prune --yes --quiet
git diff --stat

Files are written byte-for-byte as the server serves them, so an unchanged page produces no git diff. --prune keeps the tree an exact mirror by deleting local .md files whose pages left the sitemap — it lists the files and asks first unless you pass --yes, and it never touches non-Markdown files, dot-directories, or node_modules.

How it works

  1. Fetches <url>/sitemap.xml (following sitemap-index files if present).
  2. Maps every <loc> entry to a local path: https://docs.acme.com/guides/setup becomes guides/setup.md. A base path in the URL (e.g. mintlify.com/docs) is stripped from local paths.
  3. Downloads the Markdown rendition of each page by appending .md to its URL — a feature of Mintlify hosting — with limited concurrency and retries (2 retries with exponential backoff on 429/5xx/network errors).
  4. Also fetches the site root as index.md (even when the sitemap omits it), llms.txt if present, and saves a verbatim copy of sitemap.xml.

Some Mintlify sites sit behind Cloudflare Bot Management, which challenges any client whose TLS fingerprint is not a real browser's. dmint therefore fetches through impit, a browser-impersonation HTTP client, by default. Set DMINT_TRANSPORT=fetch to use plain fetch instead.

Scripting and exit codes

Code Meaning
0 Success
1 Usage error, or one or more pages failed to download
4 Network failure — the sitemap could not be fetched or parsed

Progress and results go to stdout; warnings and errors go to stderr. --quiet suppresses per-file progress but keeps the final summary.

Environment variables

Variable Description
DMINT_TRANSPORT impit (default) fetches with a browser-impersonation client; fetch uses plain fetch with a dmint/<version> user-agent

Development

bun install        # install dependencies
bun test           # run the test suite (bun:test)
bun run lint       # ts-standard
bun run compile    # build a standalone binary at dist/dmint
bun src/cli.ts     # run from source

Releasing

Releases are automated with release-please:

  1. Merge Conventional Commit PRs to main; release-please accumulates them into a Release PR.
  2. Merge the Release PR. This tags the release, publishes @mkdnsite/dmint to npm via Trusted Publishing (with provenance), compiles standalone binaries for macOS/Linux/Windows (plus musl), attests them, uploads them to the GitHub Release, and updates the Homebrew formula in mkdnsite/homebrew-tap.

License

MIT © Andrew Goode

About

Download a Mintlify docs site as a local directory of Markdown files

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages