feat: add domain verification status command#192
Conversation
Add `zeabur domain verification status` to check ICANN registrant verification status. Also show verification status in `domain list-registered`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review WalkthroughAdds two new verification subcommands ( Changes
Sequence DiagramsequenceDiagram
participant User
participant CLI
participant ApiClient
participant Output
User->>CLI: run "domain verification status" [--id]
alt id provided
CLI->>ApiClient: GetRegisteredDomain(id)
else no id & interactive
CLI->>ApiClient: ListRegisteredDomains()
ApiClient-->>CLI: domain list
CLI->>User: prompt to select domain
User-->>CLI: selects domain
CLI->>ApiClient: GetRegisteredDomain(selectedID)
else no id & non-interactive
CLI-->>User: error (id required)
end
ApiClient-->>CLI: RegisteredDomain (RegistrantVerificationStatus, RegistrantProfile)
CLI->>Output: render JSON or table (Domain, Verification Status)
alt RegistrantProfile present & table mode
CLI->>Output: render Registrant Profile table
end
Output-->>User: display results
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Query the nested registrantProfile field so users can see which registrant email is associated with a domain. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Allow updating the registrant contact info on a domain via `zeabur domain verification update-contact`. Changing the email triggers a new ICANN verification flow. Interactive mode pre-fills from the current registrant profile. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
internal/cmd/domain/verification/update_contact.go (1)
86-153: Consider extracting a helper to reduce duplication.The prompting logic in lines 86-118 (with pre-fill) and 120-152 (without pre-fill) is nearly identical. You could unify this by extracting default values first, then having a single prompting block.
♻️ Suggested refactor
if f.Interactive { - // Pre-fill from current registrant profile if available domain, err := f.ApiClient.GetRegisteredDomain(ctx, opts.id) - if err == nil && domain.RegistrantProfile != nil { - p := domain.RegistrantProfile - if opts.firstName == "" { - opts.firstName, _ = f.Prompter.Input("First name: ", p.FirstName) - } - if opts.lastName == "" { - opts.lastName, _ = f.Prompter.Input("Last name: ", p.LastName) - } - if opts.email == "" { - opts.email, _ = f.Prompter.Input("Email: ", p.Email) - } - if opts.phone == "" { - opts.phone, _ = f.Prompter.Input("Phone (e.g. +1.5551234567): ", p.Phone) - } - if opts.address1 == "" { - opts.address1, _ = f.Prompter.Input("Address: ", p.Address1) - } - if opts.address2 == "" { - opts.address2, _ = f.Prompter.Input("Address line 2 (optional): ", "") - } - if opts.city == "" { - opts.city, _ = f.Prompter.Input("City: ", p.City) - } - if opts.state == "" { - opts.state, _ = f.Prompter.Input("State/Province: ", p.State) - } - if opts.country == "" { - opts.country, _ = f.Prompter.Input("Country (e.g. US): ", p.Country) - } - if opts.postalCode == "" { - opts.postalCode, _ = f.Prompter.Input("Postal code: ", p.PostalCode) - } - if opts.organization == "" { - opts.organization, _ = f.Prompter.Input("Organization (optional): ", p.Organization) - } - } else { - if opts.firstName == "" { - opts.firstName, _ = f.Prompter.Input("First name: ", "") - } - // ... rest of prompts with empty defaults + // Pre-fill defaults from current registrant profile if available + var defaults model.RegistrantProfile + if err == nil && domain.RegistrantProfile != nil { + defaults = *domain.RegistrantProfile + } + if opts.firstName == "" { + opts.firstName, _ = f.Prompter.Input("First name: ", defaults.FirstName) + } + if opts.lastName == "" { + opts.lastName, _ = f.Prompter.Input("Last name: ", defaults.LastName) + } + // ... continue for other fields }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@internal/cmd/domain/verification/update_contact.go` around lines 86 - 153, Extract a small helper to remove the duplicated prompting block: create a function (e.g., promptIfEmpty(prompt string, currentVal string) string) that calls f.Prompter.Input and returns the chosen value, then replace the two large branches with logic that first computes default values (use p.FirstName/p.LastName/... when prefill is true, otherwise empty strings) and then calls promptIfEmpty for each field (opts.firstName, opts.lastName, opts.email, opts.phone, opts.address1, opts.address2, opts.city, opts.state, opts.country, opts.postalCode, opts.organization) so all prompting uses the single helper and the duplicated input calls to f.Prompter.Input are removed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/cmd/domain/verification/update_contact.go`:
- Around line 202-205: The note about ICANN verification is printed
unconditionally because opts.email is validated as required; instead capture the
original registrant email before prompts (e.g., store registrant.Email from the
fetched profile into originalEmail) and then compare originalEmail != opts.email
before calling f.Log.Infof("Note: changing the email triggers a new ICANN
verification flow"); update the logic around the f.Log.Infof that currently
follows the "Registrant contact updated successfully" message to only log when
the email changed (or, if storing beforehand is impossible, refetch the
registrant profile after updates and compare the before/after emails to decide
whether to log).
---
Nitpick comments:
In `@internal/cmd/domain/verification/update_contact.go`:
- Around line 86-153: Extract a small helper to remove the duplicated prompting
block: create a function (e.g., promptIfEmpty(prompt string, currentVal string)
string) that calls f.Prompter.Input and returns the chosen value, then replace
the two large branches with logic that first computes default values (use
p.FirstName/p.LastName/... when prefill is true, otherwise empty strings) and
then calls promptIfEmpty for each field (opts.firstName, opts.lastName,
opts.email, opts.phone, opts.address1, opts.address2, opts.city, opts.state,
opts.country, opts.postalCode, opts.organization) so all prompting uses the
single helper and the duplicated input calls to f.Prompter.Input are removed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f1505721-3f29-4644-9bba-a9ccae7c0559
📒 Files selected for processing (2)
internal/cmd/domain/verification/update_contact.gointernal/cmd/domain/verification/verification.go
🚧 Files skipped from review as they are similar to previous changes (1)
- internal/cmd/domain/verification/verification.go
Track the original registrant email before prompts and compare after update to avoid always showing the verification warning. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
zeabur domain verification statussubcommand to check ICANN registrant verification status for a registered domainzeabur domain list-registeredtable outputTest plan
zeabur domain verification statusinteractively and verify it shows the correct statuszeabur domain verification status --id <id>non-interactivelyzeabur domain verification status --id <id> --jsonfor JSON outputzeabur domain list-registeredand verify the new "Verification" column appears🤖 Generated with Claude Code
Summary by CodeRabbit