Skip to content

CLI and tools

CLI command reference

Use every DNSMigrator CLI command with documented inputs, options, output, exit codes, and examples for check, translate, diff, lint, export, and DNSSEC.

8 min read

On this page

The CLI command reference covers check, translate, diff, lint, export, convert, check-config, propagation, dnssec, and providers. --strict changes only the exit status for documented findings; it does not rewrite records, suppress warnings, or change a command’s result shape.

Global behavior#

text
Usage: dnsmigrator <command> [options]
OptionShortValueEffect
--json—booleanEmit the command’s JSON result on stdout.
--no-color—booleanDisable ANSI color; a non-empty NO_COLOR does the same.
--strict—booleanExit 1 when the command-specific findings condition is true.
--help-hbooleanPrint command help and exit 0 without running it.
--version-vbooleanPrint the package version; with --json, emit a version object.

The four process exit codes are 0 for completion, 1 for strict findings (and for convert input errors), 2 for usage errors, and 3 for runtime errors. A JSON error always has this shape and is written to stdout:

json
{
  "error": {
    "type": "usage",
    "message": "Missing required option --to."
  }
}

Runtime failures use "type": "runtime". See the CLI overview for shell-integration guidance.

check#

Inspect a live domain over public DNS and RDAP, then translate the records that public discovery found for one or more destinations.

text
Usage: dnsmigrator check <domain> [--to <provider>] [--all] [options]
OptionShortValueEffect
--to-tproviderShow one destination and include a record-level translation object in JSON.
--all—booleanCompare with every DNS destination instead of the featured set.
--verbose—booleanWith --to, show every discovered record rather than only summary and attention rows.
--json—booleanEmit the probe, selected compatibility entries, links, and optional translation.
--strict—booleanExit 1 if the domain appears unregistered, DNSSEC is broken, or a selected destination has warning or unsupported records.

A URL or hostname input is normalized by removing its scheme, path, port, trailing dot, and leading www; the probe then discovers the authoritative zone apex. Public discovery reports whether AXFR succeeded; otherwise it is explicitly partial.

bash
npx dnsmigrator check example.com --to route53 --verbose
text
  example.com

  DNS host    Cloudflare DNS
  Registrar   Example Registrar, Inc. · expires 2027-08-13
  Nameservers ada.ns.cloudflare.com, bob.ns.cloudflare.com
  DNSSEC      ✓ signed · Signed, and the resolver validated
  Records     7 record sets discovered · partial: found by querying common names

  Cloudflare → Route 53

  Name  Type  TTL  Value  Notes
  …

  ✓ exact          …
  ↻ translated     …
  ! review          …
  ✗ unsupported     …
  – managed         …
    total            …

  Full report: https://dnsmigrator.com/check/example.com?to=route53
  Migrate with a reviewed plan, verification and rollback: https://dnsmigrator.com/migrate/cloudflare-to-route53

JSON adds these CLI fields to the probe result:

json
{
  "domain": "example.com",
  "apex": "example.com",
  "registered": true,
  "nameservers": ["ada.ns.cloudflare.com.", "bob.ns.cloudflare.com."],
  "provider": { "id": "cloudflare", "name": "Cloudflare DNS" },
  "registrar": {},
  "dnssec": {},
  "discovery": { "records": [] },
  "compatibility": [],
  "translation": {},
  "reportUrl": "https://dnsmigrator.com/check/example.com?to=route53",
  "migrateUrl": "https://dnsmigrator.com/migrate/cloudflare-to-route53"
}

translation and migrateUrl are conditional. The exact provider, registrar, DNSSEC, discovery and compatibility fields come from the probe report. Use the DNS migration checker for the browser version.

translate#

Translate every parsed record in a BIND zone file against one destination’s capabilities and emit a destination-shaped zone.

text
Usage: dnsmigrator translate <zonefile> --to <provider> [options]
OptionShortValueEffect
--to-tproviderRequired destination provider.
--from-fproviderSource semantics for proxy, automatic TTL and provider features; defaults to zonefile.
--out-ofileWrite translated BIND text to a file instead of stdout.
--origin—domainSupply the zone name when input has no $ORIGIN.
--report—fileWrite a JSON record-by-record translation report.
--verbose—booleanShow every record row, not only the summary and attention list.
--json—booleanEmit metadata, all translated rows, parse errors and generated zone text.
--strict—booleanExit 1 for warning or unsupported rows, or for partial parse errors.

Use - as the input path to read stdin. Unsupported records are omitted from active zone data and appended as comments with their reason.

bash
npx dnsmigrator translate example.com.zone --to cloudflare --out cloudflare.zone
text
  example.com. Zone file → Cloudflare

  ✓ exact          11
  ↻ translated      3
  ! review           0
  ✗ unsupported      0
  – managed          2
    total            16

  Wrote cloudflare.zone
  Apply it with a reviewed plan, verification and rollback: https://dnsmigrator.com/migrate/zone-file-to-cloudflare

Without --out, BIND text is stdout and the summary is stderr:

text
; Translated for Cloudflare DNS by dnsmigrator 0.1.0
; Source: example.com.zone (Zone file)
$ORIGIN example.com.
$TTL 3600

@          300 IN A      192.0.2.10
www       3600 IN CNAME  example.com.

The --json result has stable top-level keys:

json
{
  "zone": "example.com.",
  "from": "zonefile",
  "to": "cloudflare",
  "input": "example.com.zone",
  "output": null,
  "report": null,
  "summary": {
    "total": 16,
    "exact": 11,
    "translated": 3,
    "warning": 0,
    "unsupported": 0,
    "skipped": 2
  },
  "records": [],
  "parseErrors": [],
  "zoneFile": "$ORIGIN example.com.\n…",
  "migrateUrl": "https://dnsmigrator.com/migrate/zone-file-to-cloudflare"
}

A file written by --report contains generator, input, the complete translation result, and parseErrors. See Translation rules.

diff#

Compare two files for the same zone as record sets. The first file is “before”; the second is “after.” SOA, DNSKEY and apex NS are ignored because DNS hosts manage them.

text
Usage: dnsmigrator diff <a.zone> <b.zone> [options]
OptionShortValueEffect
--origin—domainSupply one origin for files without $ORIGIN.
--json—booleanEmit both input names, summary, changed records and parse errors.
--strict—booleanExit 1 if any record set was added, removed or changed.
bash
npx dnsmigrator diff before.zone after.zone
text
  before.zone → after.zone  example.com.

    Name    Type   TTL   Value
  + blog    CNAME  3600  blog.example-hosting.net.
  - legacy  SPF    3600  v=spf1 -all
  ~ @       A       300  192.0.2.10
                             192.0.2.11

  1 added, 3 removed, 3 changed, 8 unchanged record sets

JSON preserves full record objects:

json
{
  "zone": "example.com.",
  "a": "before.zone",
  "b": "after.zone",
  "summary": { "added": 1, "removed": 3, "changed": 3, "unchanged": 8 },
  "added": [],
  "removed": [],
  "changed": [{ "before": {}, "after": {} }],
  "parseErrors": { "a": [], "b": [] }
}

Files with different origins are a usage error. Use the zone diff for the in-browser equivalent.

lint#

Parse a BIND file and run generic DNS checks, then optionally apply one provider’s capability limits.

text
Usage: dnsmigrator lint <zonefile> [--provider <id>] [options]
OptionShortValueEffect
--provider-pproviderCheck destination record types, TTL range and TXT limits.
--origin—domainSupply the zone name when input has no $ORIGIN.
--json—booleanEmit findings with code, severity, message and available record location.
--strict—booleanExit 1 if at least one error or warning exists; informational findings alone do not fail.

Checks include parse errors, duplicates, CNAME coexistence and multiplicity, apex CNAMEs, MX/SRV/NS targets that are CNAMEs, SPF conflicts, TXT chunking, and invalid or unusual TTLs. A provider adds catalog-specific constraints.

bash
npx dnsmigrator lint problems.zone
text
  problems.zone  problems.example. · 16 record sets

  Line  Severity   Name  Type   Message
     6  i info     @     CNAME  …
    10  ✗ error    www   CNAME  www.problems.example. has a CNAME and A records…
    14  ! warning  dup   A      Duplicate of line 13…

  8 errors, 3 warnings, 2 info
  Validate in the browser: https://dnsmigrator.com/tools/zone-file-validator

JSON shape:

json
{
  "file": "problems.zone",
  "zone": "problems.example.",
  "provider": "godaddy",
  "records": 16,
  "findings": [
    {
      "severity": "warning",
      "code": "duplicate-record",
      "message": "Duplicate of line 13. Providers store it once or reject the import.",
      "name": "dup",
      "type": "A",
      "line": 14
    }
  ],
  "summary": { "error": 8, "warning": 3, "info": 2 }
}

The browser zone file validator checks parseability and normalization, not this full lint rule set.

export#

Read one BIND zone, octoDNS YamlProvider file, or dnsconfig.js, then emit a zone or inventory format.

text
Usage: dnsmigrator export <file> --format bind|json|dnsconfig|djs|octodns|octodns-config|tsv|nameonly|etchosts [options]

--format is optional and defaults to bind.

OptionShortValueEffect
--format-Foutput formatSelect one of the nine formats above.
--from—bind, octodns, dnsconfigOverride input detection. .yaml/.yml means octoDNS, .js means dnsconfig.js, and other names mean BIND.
--out-ofileWrite content to a file instead of stdout.
--provider-pproviderSet the provider in generated dnsconfig.js or the octoDNS starter config; defaults to BIND/zone file.
--origin—domainSupply the zone name for BIND input without $ORIGIN.
--zone—domainSupply the octoDNS zone name or choose one D() declaration from dnsconfig.js.
--var—name=value, repeatableDefine DNSControl variables; CLI_DEFAULTS() supplies omitted defaults.
--json—booleanEmit output content, metadata, parse errors, and warnings as one JSON object.
--strict—booleanExit 1 for BIND parse errors; octoDNS and dnsconfig.js input also fail on import warnings.

Output formats are:

FormatResult
bindNormalized, sorted BIND text.
jsonCanonical zone object.
dnsconfigGenerated DNSControl dnsconfig.js.
djsdnsconfig.js with leading commas, matching get-zones --format=djs.
octodnsoctoDNS YamlProvider zone YAML.
octodns-configStarter config.yaml with provider classes and env/NAME placeholders, never real secrets.
tsvFQDN, label, TTL, type, value, and properties.
nameonlyBare zone name.
etchostsA and AAAA values as /etc/hosts lines; other records produce a warning.
bash
npx dnsmigrator export example.com.zone --format octodns > config/example.com.yaml
npx dnsmigrator export example.com.zone --format octodns-config --provider route53 > config.yaml
npx dnsmigrator export dnsconfig.js --format tsv --zone example.com --var env=prod

With --json, the stable top-level fields are:

json
{
  "format": "octodns",
  "from": "bind",
  "zone": "example.com.",
  "records": 16,
  "output": null,
  "content": "---\n…",
  "parseErrors": [],
  "warnings": []
}

Read Coming from DNSControl for JavaScript import limits and dnsconfig.js import and export for the browser workflow.

convert#

Convert one zone among BIND, octoDNS YAML, and dnsconfig.js without provider credentials.

text
Usage: dnsmigrator convert <file> --to octodns|bind|dnsconfig [--from octodns|bind|dnsconfig] [options]
OptionShortValueEffect
--to-toctodns, bind, dnsconfigRequired output format.
--from—octodns, bind, dnsconfigOverride extension-based input detection.
--zone—domainSupply the octoDNS zone name or choose one D() from JavaScript.
--out-ofileWrite to a file instead of stdout.
--var—name=value, repeatableDefine variables while evaluating dnsconfig.js.
--json—booleanEmit from, to, zone, record count, content, errors, and warnings.
--strict—booleanAlso exit 1 for a conversion warning. Input errors exit 1 without it.
bash
npx dnsmigrator convert config/example.com.yaml --to bind > example.com.zone
npx dnsmigrator convert dnsconfig.js --to octodns --zone example.com > config/example.com.yaml
npx dnsmigrator convert example.com.zone --to dnsconfig --out dnsconfig.js

The converter reports records and settings the destination file format cannot hold. Review warnings before replacing a configuration repository. Records in the input that can't be parsed are reported as errors and left out of the output, and convert exits 1 even without --strict, so a script never mistakes a partial file for a full conversion.

check-config#

Evaluate a DNSControl dnsconfig.js in a sandbox and lint every declared zone, or print the evaluated intermediate representation.

text
Usage: dnsmigrator check-config <dnsconfig.js> [--ir] [--var name=value] [options]
OptionShortValueEffect
--ir—booleanWrite the evaluated desired-zone array as JSON.
--var—name=value, repeatableDefine script variables; CLI_DEFAULTS() fills omitted names.
--json—booleanEmit the full evaluation, provider declarations, lint results, and summary. This takes precedence over the compact --ir output.
--strict—booleanExit 1 for script/import errors, importer warnings, or lint errors and warnings.
bash
npx dnsmigrator check-config dnsconfig.js --strict
npx dnsmigrator check-config dnsconfig.js --var env=production --ir > ir.json

The Node.js VM has a three-second execution limit, no network, and no require, glob, or FETCH support. HASH() supports SHA1, SHA256, and SHA512. Because the CLI has no DNS resolver, imported SPF_BUILDER flattening remains unflattened and emits a warning; the browser importer can resolve selected includes.

propagation#

Query the configured public resolver set for one owner name and record type, compare answers, and optionally match an expected set.

text
Usage: dnsmigrator propagation <name> [--type A] [--expect <value>...] [options]
OptionShortValueEffect
--type-trecord typeQuery type; defaults to A.
--expect-evalue, repeatableCompare each resolver’s normalized answer with the complete expected set.
--json—booleanEmit the propagation report plus browser URL.
--strict—booleanExit 1 if answers differ, any resolver fails to answer, or any answer misses --expect.

Accepted query types are A, AAAA, CNAME, MX, TXT, NS, SRV, CAA, SOA, PTR, DS, DNSKEY, HTTPS, SVCB, TLSA, SSHFP, NAPTR, SPF, LOC, CERT, and URI.

bash
npx dnsmigrator propagation example.com --type A --expect 192.0.2.10 --strict
text
  example.com A

    Resolver           Location  Answer       TTL  Time
  ✓ Cloudflare         Anycast   192.0.2.10   300  12ms
  ✓ Google Public DNS  Anycast   192.0.2.10   120  20ms

  2/2 resolvers answered · consistent · 2/2 match the expected value
  Watch it in the browser: https://dnsmigrator.com/tools/propagation-checker?name=example.com&type=A

The JSON report includes name, type, optional expected, a results row per resolver, summary, and url. Use the propagation checker for a smaller browser query-type set.

dnssec#

Read DS records from the parent, DNSKEY records from the child, compare key tags, and report whether a validating resolver accepts the chain.

text
Usage: dnsmigrator dnssec <domain> [options]

There are no command-specific flags.

OptionEffect
--jsonEmit the DNSSEC report plus nameservers, detected provider and browser URL.
--strictExit 1 unless status is signed; unsigned, broken and unknown all fail strict mode.
bash
npx dnsmigrator dnssec example.com
text
  example.com  ✓ signed
  Signed, and the resolver validated.

  DS at parent  key 2371 · algorithm 13 · digest type 2
  DNSKEY        key 2371 · algorithm 13 · KSK (flags 257)
                key 34505 · algorithm 13 · ZSK (flags 256)
  Matching keys 2371
  Validated     yes
  Nameservers   ada.ns.cloudflare.com, bob.ns.cloudflare.com
  DNS host      Cloudflare DNS

  Check in the browser: https://dnsmigrator.com/tools/dnssec-checker?domain=example.com

JSON shape extends the DNSSEC report:

json
{
  "domain": "example.com",
  "status": "signed",
  "detail": "Signed, and the resolver validated.",
  "ds": [],
  "dnskeys": [],
  "matchingKeyTags": [2371],
  "resolverValidated": true,
  "nameservers": [],
  "provider": { "id": "cloudflare", "name": "Cloudflare DNS" },
  "url": "https://dnsmigrator.com/tools/dnssec-checker?domain=example.com"
}

Use DNSSEC transitions before changing nameservers for a signed zone.

providers#

List the bundled DNS catalog or show one provider’s capability sheet. The list includes the BIND zone-file pseudo-provider and the read-only Zone transfer source; registrar-only entries are rejected.

text
Usage: dnsmigrator providers [<id>] [--featured] [options]
OptionValueEffect
--featuredbooleanLimit list output to featured providers. Ignored when a specific provider is supplied.
--jsonbooleanEmit an array for a list or one object for a specific provider.
--strictbooleanAccepted as a global option, but this command has no findings condition and returns 0 on success.
bash
npx dnsmigrator providers cloudflare
text
  Cloudflare DNS  cloudflare · cloud · featured · verified

  Record types  A, AAAA, CNAME, …
  TTL           1m to 1d, default auto
  Apex          CNAME
  Proxy / CDN   yes
  Routing       –
  TXT length    … bytes
  DNSSEC        api, auto
  Batch size    …
  Web app auth  API token
  DNSControl    CLOUDFLAREAPI
  Docs          https://…

  Caveats
  • …

List JSON objects contain:

json
{
  "id": "cloudflare",
  "name": "Cloudflare DNS",
  "shortName": "Cloudflare",
  "slug": "cloudflare",
  "kind": "cloud",
  "dns": true,
  "registrar": false,
  "featured": true,
  "verified": true,
  "dnscontrol": "CLOUDFLAREAPI",
  "docsUrl": "https://…",
  "auth": "API token",
  "caveats": [],
  "nameserverPatterns": [],
  "capabilities": {}
}

capabilities.batchSize is null when the internal value is unlimited. For setup instructions rather than machine-readable capabilities, use Supported providers.