Skip to content

feat(dns): manage DNS zones and records#91

Merged
jamie-at-bunny merged 5 commits into
mainfrom
feat/dns
Jun 5, 2026
Merged

feat(dns): manage DNS zones and records#91
jamie-at-bunny merged 5 commits into
mainfrom
feat/dns

Conversation

@jamie-at-bunny
Copy link
Copy Markdown
Member

No description provided.

@bogdan-at-bunny
Copy link
Copy Markdown

@codex review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 4, 2026

🦋 Changeset detected

Latest commit: 012303b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@bunny.net/openapi-client Patch
@bunny.net/cli Minor
@bunny.net/app-config Patch
@bunny.net/cli-linux-x64 Minor
@bunny.net/cli-linux-arm64 Minor
@bunny.net/cli-darwin-x64 Minor
@bunny.net/cli-darwin-arm64 Minor
@bunny.net/cli-windows-x64 Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Jun 4, 2026

Greptile Summary

This PR adds an experimental bunny dns command tree for managing DNS zones and records, and also patches the shared OpenAPI middleware to let legitimate empty non-JSON 200 responses pass through without triggering the proxy-interception guard.

  • DNS zone commands: list, add, remove, show, stats, nameservers, plus dnssec enable/disable and logging enable/disable sub-namespaces, all with interactive zone pickers and --output json support.
  • DNS record commands: list, add, remove, update, export (BIND zone-file), and import, with per-type field handling for MX, SRV, CAA, PULLZONE, and SCRIPT records.
  • Middleware fix: The proxy-interception guard in middleware.ts now skips throwing when the response body is empty, fixing false positives for endpoints that return 204-style empty bodies with non-JSON content types.

Confidence Score: 4/5

Safe to merge after fixing the three spinner-leak paths in stats, dnssec/disable, and logging/disable.

Three commands — dns zone stats, dns zone dnssec disable, and dns zone logging disable — call spin.stop() outside a try/finally block. When the underlying API call throws, the terminal is left with an animating spinner alongside the error message. The rest of the command tree (15+ other handlers) consistently uses try/finally for spinner cleanup, so this is an inconsistency in the three affected files rather than a systemic design problem.

packages/cli/src/commands/dns/zone/stats.ts, packages/cli/src/commands/dns/zone/dnssec/disable.ts, packages/cli/src/commands/dns/zone/logging/disable.ts

Important Files Changed

Filename Overview
packages/cli/src/commands/dns/zone/stats.ts DNS zone statistics command — spinner not wrapped in try/finally, leaks on API error
packages/cli/src/commands/dns/zone/dnssec/disable.ts DNSSEC disable command — spinner not in try/finally, leaks if DELETE throws
packages/cli/src/commands/dns/zone/logging/disable.ts Logging disable command — spinner not in try/finally, leaks if POST throws
packages/cli/src/commands/dns/api.ts Core DNS API helpers — fetchZones (paginated), fetchZone, and resolveZone (domain-or-ID resolver) are correct
packages/cli/src/commands/dns/interactive.ts Interactive zone/record pickers with correct try/finally spinner guards and prompt abort handling
packages/cli/src/commands/dns/record/add.ts DNS record add — per-type buildRecord/promptRecord logic, proper spinner guard, nullish-safe success message
packages/cli/src/commands/dns/record/list.ts Record list — correctly outputs records array (not full zone) for JSON mode
packages/openapi-client/src/middleware.ts Middleware fix — non-JSON 200 responses with empty bodies now pass through cleanly
packages/cli/src/commands/dns/record-types.ts Record type enum, label lookup, parser, and formatRecordValue — correct and well-tested
packages/cli/src/commands/dns/record/import.ts BIND zone-file import — reads local file, POSTs as text/plain with try/finally spinner
packages/cli/src/commands/dns/record/export.ts Zone export — correctly uses parseAs:"text", try/finally spinner, stdout or file output
packages/cli/src/commands/dns/zone/logging/enable.ts Logging enable — correct try/finally guard, properly threads anonymization flags

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    CLI[bunny dns] --> ZoneNS[dns zone]
    CLI --> RecordNS[dns record]
    ZoneNS --> ZList[list]
    ZoneNS --> ZAdd[add]
    ZoneNS --> ZRemove[remove]
    ZoneNS --> ZShow[show]
    ZoneNS --> ZStats[stats]
    ZoneNS --> ZNS[nameservers]
    ZoneNS --> DNSSEC[dnssec]
    ZoneNS --> Logging[logging]
    DNSSEC --> DnsEnable[enable]
    DNSSEC --> DnsDisable[disable]
    Logging --> LogEnable[enable]
    Logging --> LogDisable[disable]
    RecordNS --> RList[list]
    RecordNS --> RAdd[add]
    RecordNS --> RRemove[remove]
    RecordNS --> RUpdate[update]
    RecordNS --> RExport[export]
    RecordNS --> RImport[import]
    ZList & ZAdd & ZRemove & ZShow & ZStats & ZNS & DnsEnable & DnsDisable & LogEnable & LogDisable --> resolveZone[resolveZoneInteractive]
    RList & RAdd & RRemove & RUpdate & RExport & RImport --> resolveZone
    RRemove & RUpdate --> resolveRecord[resolveRecordInteractive]
    resolveZone --> API[api.ts: fetchZones / fetchZone / resolveZone]
    API --> CoreAPI[CoreClient → bunny.net API]
Loading

Fix All in Claude Code

Reviews (4): Last reviewed commit: "fix AcceleratedPullZoneId" | Re-trigger Greptile

Comment thread packages/cli/src/commands/dns/api.ts
Comment thread packages/cli/src/commands/dns/record/list.ts
Comment thread packages/cli/src/commands/dns/interactive.ts Outdated
Comment thread packages/cli/src/commands/dns/record/add.ts
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f18945ad4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/openapi-client/src/middleware.ts Outdated
Comment thread packages/cli/src/commands/dns/record/update.ts
Comment thread packages/cli/src/commands/dns/record/list.ts Outdated
Comment thread packages/cli/src/commands/dns/index.ts Outdated
Comment thread packages/cli/src/commands/dns/api.ts Outdated
Comment thread packages/cli/src/commands/dns/zone/logging/enable.ts
@jamie-at-bunny jamie-at-bunny merged commit 73cb7a7 into main Jun 5, 2026
1 check passed
@jamie-at-bunny jamie-at-bunny deleted the feat/dns branch June 5, 2026 09:08
@github-actions github-actions Bot mentioned this pull request Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants