Skip to content

feat(cli): add domains claim command for cross-store domain ownership#3084

Merged
jorgemoya merged 2 commits into
canaryfrom
jorgemoya/ltrac-1106-implement-domain-claiming-functionality-in-the-cli
Jul 8, 2026
Merged

feat(cli): add domains claim command for cross-store domain ownership#3084
jorgemoya merged 2 commits into
canaryfrom
jorgemoya/ltrac-1106-implement-domain-claiming-functionality-in-the-cli

Conversation

@jorgemoya

Copy link
Copy Markdown
Contributor

Linear: LTRAC-1106

What/Why?

The catalyst domains claim command was missed from the initial Native Hosting CLI work. It lets a user claim ownership of a custom domain that is already in use on another store/project — publish the ownership-verification TXT record, then run claim to release the domain from the other store and bind it to the current project (POST .../projects/{project_uuid}/domains/{domain}/claim).

The Domains API returns the TXT record to publish in the meta.ownership_verification field of a cross-store collision. Rather than let it surface as an opaque error, it's parsed into a typed DomainOwnershipVerificationError so:

  • domains add — on a 409 cross-store collision, prints the TXT record plus Then run: catalyst domains claim <domain>.
  • domains claim — on a 422 not-yet-verified claim, reprints the TXT record so the user can publish it and retry.

claim mirrors add/status: after a successful claim it shows the domain status, and --wait polls until the domain leaves pending verification.

Docs (CLI reference + native-hosting getting-started) are updated in a separate docs-v2 change.

Testing

pnpm --filter @bigcommerce/catalyst test src/cli/commands/domains.spec.ts (31 passing), plus pnpm typecheck and pnpm lint. New coverage: claimDomain success + 422 verification error, the claim command (success, unverified TXT reprint, --wait), and the add cross-store collision path. Verified catalyst domains claim --help on the built CLI.

Migration

None.

Add `catalyst domains claim <domain>` so users can claim ownership of a
custom domain that is already in use on another store. Publishing the
ownership-verification TXT record and then claiming releases the domain
from the other store and binds it to the current project.

The Domains API returns the TXT record in the `meta.ownership_verification`
field of a cross-store collision. Surface it as a typed
DomainOwnershipVerificationError so both `domains add` (on a 409 collision)
and `domains claim` (on a 422 unverified claim) print the record and the
next step instead of an opaque error.

Refs LTRAC-1106
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jorgemoya
jorgemoya requested a review from a team as a code owner July 7, 2026 18:57
@changeset-bot

changeset-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f500436

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

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst 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

@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
catalyst Ready Ready Preview, Comment Jul 8, 2026 6:18pm

Request Review

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Report

Comparing against baseline from cb7d025 (2026-07-08).

No bundle size changes detected.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Unlighthouse Performance Comparison — Vercel

Comparing PR preview deployment Unlighthouse scores vs production Unlighthouse scores.

Summary Score

Aggregate score across all categories as reported by Unlighthouse.

Prod Desktop Prod Mobile Preview Desktop Preview Mobile
Score 89 93 91 94

Category Scores

Category Prod Desktop Prod Mobile Preview Desktop Preview Mobile
Performance 74 88 76 91
Accessibility 95 98 95 92
Best Practices 100 100 100 100
SEO 88 88 100 100

Core Web Vitals

Metric Prod Desktop Prod Mobile Preview Desktop Preview Mobile
LCP 3.9 s 3.8 s 3.7 s 3.5 s
CLS 0.037 0 0.001 0
FCP 1.2 s 1.2 s 1.2 s 1.1 s
TBT 0 ms 0 ms 0 ms 10 ms
Max Potential FID 50 ms 50 ms 40 ms 70 ms
Time to Interactive 3.9 s 3.9 s 3.7 s 4.1 s

Full Unlighthouse report →

@jorgemoya

jorgemoya commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Testing

Not added

❯ node ../packages/catalyst/dist/cli.js domains claim www.jorgemoya.dev --api-host api.staging.zone
◢ @bigcommerce/catalyst v1.0.0                                                                                                                           3:26:54 PM

◐ Claiming domain www.jorgemoya.dev...                                                                                                                   3:26:54 PM

 ERROR  The domain is not bound to any project. Add it with the create endpoint instead. (domain: 'www.jorgemoya.dev' is not bound to any project.)      3:26:55 PM

Added

~/dev/catalyst/core on  jorgemoya/ltrac-1106-implement-domain-claiming-functionality-in-the-cli [✘!?] took 3s
❯ node ../packages/catalyst/dist/cli.js domains claim www.jorgemoya.dev --api-host api.staging.zone
◢ @bigcommerce/catalyst v1.0.0                                                                                                                           3:27:23 PM

◐ Claiming domain www.jorgemoya.dev...                                                                                                                   3:27:23 PM
✔ Domain www.jorgemoya.dev claimed.                                                                                                                     3:27:23 PM
www.jorgemoya.dev active    

Already exists but to different project

~/dev/catalyst/core on  jorgemoya/ltrac-1106-implement-domain-claiming-functionality-in-the-cli [✘!?] took 7s
❯ node ../packages/catalyst/dist/cli.js domains claim www.jorgemoya.dev --api-host api.staging.zone
◢ @bigcommerce/catalyst v1.0.0                                                                                                                          11:21:47 AM

◐ Claiming domain www.jorgemoya.dev...                                                                                                                  11:21:47 AM

[11:21:48 AM]  ERROR  The domain is already bound to another project in this store. Use the transfer endpoint to move it. (domain: 'www.jorgemoya.dev' is already bound to another project in this store.)

Domain already added to another store:

~/dev/catalyst/core on  jorgemoya/ltrac-1115-user-actionable-cli-errors [✘!?]
❯ node ../packages/catalyst/dist/cli.js domains add storetools.app
◢ @bigcommerce/catalyst v1.0.0                                                                                                                          12:37:49 PM

◐ Adding domain storetools.app...                                                                                                                       12:37:49 PM

 WARN  storetools.app is already in use on another store.                                                                                               12:37:49 PM

Add this DNS record to verify ownership:                                                                                                                12:37:49 PM
  Type:  TXT
  Name:  _commerce-verify.storetools.app
  Value: c9fe1b2157cc04f5e7b933cfe03ce959417a24bcf1bd0718579a156c2d6785845ee886e8c63dd6aa3b204194f1547e97264db6e73e7f020694c88a96e035f6a3edbbff1a675bba5732b3b02b54ecf6507c01a3b4a1d5701d7594
ℹ Once the record is live, run: catalyst domains claim storetools.app        

@jordanarldt

Copy link
Copy Markdown
Contributor

@jorgemoya can you add a screenshot or the log output of adding a domain that is already taken where it returns the claim records?

@jorgemoya
jorgemoya force-pushed the jorgemoya/ltrac-1106-implement-domain-claiming-functionality-in-the-cli branch from 738cd8f to 6d780bc Compare July 8, 2026 16:47
@jorgemoya
jorgemoya force-pushed the jorgemoya/ltrac-1106-implement-domain-claiming-functionality-in-the-cli branch from 431b401 to 6d780bc Compare July 8, 2026 17:40
When `domains add` hits a domain already in use on another store, the WARN line
echoed the V3 error's title and field message, which repeat each other. Print a
concise, purpose-written line instead and let the DNS record plus next-step
guidance carry the detail. Same tidy-up for `domains claim`'s not-yet-verified
message. Follows the existing convention of mapping a detected error condition
to CLI-authored guidance (see UnauthorizedError, the "API not enabled" 403s).

Refs LTRAC-1106
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jorgemoya
jorgemoya added this pull request to the merge queue Jul 8, 2026
Merged via the queue into canary with commit aadaf27 Jul 8, 2026
25 of 26 checks passed
@jorgemoya
jorgemoya deleted the jorgemoya/ltrac-1106-implement-domain-claiming-functionality-in-the-cli branch July 8, 2026 19:46
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