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#
Usage: dnsmigrator <command> [options]| Option | Short | Value | Effect |
|---|---|---|---|
--json | — | boolean | Emit the command’s JSON result on stdout. |
--no-color | — | boolean | Disable ANSI color; a non-empty NO_COLOR does the same. |
--strict | — | boolean | Exit 1 when the command-specific findings condition is true. |
--help | -h | boolean | Print command help and exit 0 without running it. |
--version | -v | boolean | Print 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:
{
"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.
Usage: dnsmigrator check <domain> [--to <provider>] [--all] [options]| Option | Short | Value | Effect |
|---|---|---|---|
--to | -t | provider | Show one destination and include a record-level translation object in JSON. |
--all | — | boolean | Compare with every DNS destination instead of the featured set. |
--verbose | — | boolean | With --to, show every discovered record rather than only summary and attention rows. |
--json | — | boolean | Emit the probe, selected compatibility entries, links, and optional translation. |
--strict | — | boolean | Exit 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.
npx dnsmigrator check example.com --to route53 --verbose 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-route53JSON adds these CLI fields to the probe result:
{
"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.
Usage: dnsmigrator translate <zonefile> --to <provider> [options]| Option | Short | Value | Effect |
|---|---|---|---|
--to | -t | provider | Required destination provider. |
--from | -f | provider | Source semantics for proxy, automatic TTL and provider features; defaults to zonefile. |
--out | -o | file | Write translated BIND text to a file instead of stdout. |
--origin | — | domain | Supply the zone name when input has no $ORIGIN. |
--report | — | file | Write a JSON record-by-record translation report. |
--verbose | — | boolean | Show every record row, not only the summary and attention list. |
--json | — | boolean | Emit metadata, all translated rows, parse errors and generated zone text. |
--strict | — | boolean | Exit 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.
npx dnsmigrator translate example.com.zone --to cloudflare --out cloudflare.zone 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-cloudflareWithout --out, BIND text is stdout and the summary is stderr:
; 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:
{
"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.
Usage: dnsmigrator diff <a.zone> <b.zone> [options]| Option | Short | Value | Effect |
|---|---|---|---|
--origin | — | domain | Supply one origin for files without $ORIGIN. |
--json | — | boolean | Emit both input names, summary, changed records and parse errors. |
--strict | — | boolean | Exit 1 if any record set was added, removed or changed. |
npx dnsmigrator diff before.zone after.zone 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 setsJSON preserves full record objects:
{
"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.
Usage: dnsmigrator lint <zonefile> [--provider <id>] [options]| Option | Short | Value | Effect |
|---|---|---|---|
--provider | -p | provider | Check destination record types, TTL range and TXT limits. |
--origin | — | domain | Supply the zone name when input has no $ORIGIN. |
--json | — | boolean | Emit findings with code, severity, message and available record location. |
--strict | — | boolean | Exit 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.
npx dnsmigrator lint problems.zone 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-validatorJSON shape:
{
"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.
Usage: dnsmigrator export <file> --format bind|json|dnsconfig|djs|octodns|octodns-config|tsv|nameonly|etchosts [options]--format is optional and defaults to bind.
| Option | Short | Value | Effect |
|---|---|---|---|
--format | -F | output format | Select one of the nine formats above. |
--from | — | bind, octodns, dnsconfig | Override input detection. .yaml/.yml means octoDNS, .js means dnsconfig.js, and other names mean BIND. |
--out | -o | file | Write content to a file instead of stdout. |
--provider | -p | provider | Set the provider in generated dnsconfig.js or the octoDNS starter config; defaults to BIND/zone file. |
--origin | — | domain | Supply the zone name for BIND input without $ORIGIN. |
--zone | — | domain | Supply the octoDNS zone name or choose one D() declaration from dnsconfig.js. |
--var | — | name=value, repeatable | Define DNSControl variables; CLI_DEFAULTS() supplies omitted defaults. |
--json | — | boolean | Emit output content, metadata, parse errors, and warnings as one JSON object. |
--strict | — | boolean | Exit 1 for BIND parse errors; octoDNS and dnsconfig.js input also fail on import warnings. |
Output formats are:
| Format | Result |
|---|---|
bind | Normalized, sorted BIND text. |
json | Canonical zone object. |
dnsconfig | Generated DNSControl dnsconfig.js. |
djs | dnsconfig.js with leading commas, matching get-zones --format=djs. |
octodns | octoDNS YamlProvider zone YAML. |
octodns-config | Starter config.yaml with provider classes and env/NAME placeholders, never real secrets. |
tsv | FQDN, label, TTL, type, value, and properties. |
nameonly | Bare zone name. |
etchosts | A and AAAA values as /etc/hosts lines; other records produce a warning. |
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=prodWith --json, the stable top-level fields are:
{
"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.
Usage: dnsmigrator convert <file> --to octodns|bind|dnsconfig [--from octodns|bind|dnsconfig] [options]| Option | Short | Value | Effect |
|---|---|---|---|
--to | -t | octodns, bind, dnsconfig | Required output format. |
--from | — | octodns, bind, dnsconfig | Override extension-based input detection. |
--zone | — | domain | Supply the octoDNS zone name or choose one D() from JavaScript. |
--out | -o | file | Write to a file instead of stdout. |
--var | — | name=value, repeatable | Define variables while evaluating dnsconfig.js. |
--json | — | boolean | Emit from, to, zone, record count, content, errors, and warnings. |
--strict | — | boolean | Also exit 1 for a conversion warning. Input errors exit 1 without it. |
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.jsThe 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.
Usage: dnsmigrator check-config <dnsconfig.js> [--ir] [--var name=value] [options]| Option | Short | Value | Effect |
|---|---|---|---|
--ir | — | boolean | Write the evaluated desired-zone array as JSON. |
--var | — | name=value, repeatable | Define script variables; CLI_DEFAULTS() fills omitted names. |
--json | — | boolean | Emit the full evaluation, provider declarations, lint results, and summary. This takes precedence over the compact --ir output. |
--strict | — | boolean | Exit 1 for script/import errors, importer warnings, or lint errors and warnings. |
npx dnsmigrator check-config dnsconfig.js --strict
npx dnsmigrator check-config dnsconfig.js --var env=production --ir > ir.jsonThe 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.
Usage: dnsmigrator propagation <name> [--type A] [--expect <value>...] [options]| Option | Short | Value | Effect |
|---|---|---|---|
--type | -t | record type | Query type; defaults to A. |
--expect | -e | value, repeatable | Compare each resolver’s normalized answer with the complete expected set. |
--json | — | boolean | Emit the propagation report plus browser URL. |
--strict | — | boolean | Exit 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.
npx dnsmigrator propagation example.com --type A --expect 192.0.2.10 --strict 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=AThe 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.
Usage: dnsmigrator dnssec <domain> [options]There are no command-specific flags.
| Option | Effect |
|---|---|
--json | Emit the DNSSEC report plus nameservers, detected provider and browser URL. |
--strict | Exit 1 unless status is signed; unsigned, broken and unknown all fail strict mode. |
npx dnsmigrator dnssec example.com 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.comJSON shape extends the DNSSEC report:
{
"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.
Usage: dnsmigrator providers [<id>] [--featured] [options]| Option | Value | Effect |
|---|---|---|
--featured | boolean | Limit list output to featured providers. Ignored when a specific provider is supplied. |
--json | boolean | Emit an array for a list or one object for a specific provider. |
--strict | boolean | Accepted as a global option, but this command has no findings condition and returns 0 on success. |
npx dnsmigrator providers cloudflare 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:
{
"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.