domain-hound 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  "plugins": [
5
5
  {
6
6
  "name": "domain-hound",
7
- "version": "0.1.7",
7
+ "version": "0.1.8",
8
8
  "source": { "source": "local", "path": "./" },
9
9
  "policy": { "installation": "AVAILABLE", "authentication": "ON_INSTALL" },
10
10
  "category": "Productivity"
@@ -5,9 +5,9 @@
5
5
  "plugins": [
6
6
  {
7
7
  "name": "domain-hound",
8
- "version": "0.1.7",
8
+ "version": "0.1.8",
9
9
  "source": "./",
10
- "description": "Check domains, compare registrar prices, and screen product names."
10
+ "description": "Domains for agents. One MCP for everything domains: find, check, buy, set up, watch, move, renew, keep track."
11
11
  }
12
12
  ]
13
13
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "domain-hound",
3
3
  "displayName": "Domain Hound",
4
- "version": "0.1.7",
5
- "description": "Check domain availability and prices, and screen product names, from your AI assistant.",
4
+ "version": "0.1.8",
5
+ "description": "Domains for agents. One MCP for everything domains: find, check, buy, set up, watch, move, renew, keep track.",
6
6
  "author": {
7
7
  "name": "Lars Hvinden"
8
8
  },
package/README.md CHANGED
@@ -1,6 +1,14 @@
1
- # Find a startup name and a domain you can actually buy
1
+ # Domain Hound: Domains for agents
2
2
 
3
- Domain Hound checks domain availability, first-year and renewal prices, app names, trademarks and social handles from Claude Code, Codex or any MCP client. It runs locally. Connect your Spaceship account to quote a domain, buy it with your approval, and set up DNS.
3
+ One MCP for everything domains: find, check, buy, set up, watch, move, renew, keep track.
4
+
5
+ Domain Hound finds names and checks domain availability, first-year and renewal prices, app names, trademarks and social handles from Claude Code, Codex or any MCP client. Connect your Spaceship account to quote a domain, buy it with your approval and set up DNS. It also investigates and watches taken domains, plans moves to a cheaper registrar, and keeps track of every domain you own. It runs locally.
6
+
7
+ - **Find and check:** `triage_names`, `check_domains`, `naming_method`
8
+ - **Buy and set up:** `quote_domain`, `buy_domain`, `setup_domain`
9
+ - **Watch taken domains:** `taken_domain_dossier`, `watch_domain`
10
+ - **Plan a move:** `move_domain`
11
+ - **Track domains and renewals:** `my_domains`
4
12
 
5
13
  ![Live Domain Hound results with completed app checks and dated upfront and renewal prices](assets/readme-search.png)
6
14
 
@@ -35,12 +43,15 @@ Add this to the client’s MCP configuration for a local stdio server.
35
43
  }
36
44
  ```
37
45
 
38
- Then ask, for example: “Is lanternbay.com available?”, “Find a name for my meeting-room booking app” or “Is the app name Quiet Otter taken?”
46
+ Then ask, for example: “Is lanternbay.com available?”, “Find a name for my meeting-room booking app”, “Is the app name Quiet Otter taken?”, “Buy lanternbay.com and point it at my Vercel site” or “Which of my domains expire soon?”
47
+
48
+ ## Find and check
39
49
 
40
- ## What it checks
50
+ ### What it checks
41
51
 
42
- - **Domains:** registry RDAP or WHOIS for fourteen endings by default (.com, .ai, .io, .me, .co, .dev, .app, .si, .so, .no, .net, .org, .xyz, .tech) and, on request, .sh, .gg, .inc, .studio, .se, .dk, .de, .uk, .co.uk and .eu. A domain is never called free without a registry or shop answer.
43
- - **Prices:** first payment, renewal and three-year cost from first-party registrar price lists, each with its date and label; renewal jumps and premium risk are flagged.
52
+ - **Domains:** registry RDAP or WHOIS for twelve endings by default (.com, .ai, .io, .me, .co, .dev, .app, .si, .so, .no, .xyz, .tech) and, on request, .net, .org, .sh, .gg, .inc, .studio, .se, .dk, .de, .uk, .co.uk and .eu. A domain is never called free without a registry or shop answer.
53
+ - **Pick:** one quality order for AI-native companies: .com, .ai, .io, .dev, .app, .co, .so, .me, .si, then .xyz and .tech; other endings follow. The pick is the highest-quality free ending you can register whose payments over 3 years stay within $60, or within your budget when you give one; if none fits, it is the one with the least paid over 3 years. .ai is never the default pick unless you ask for it or its 3-year total fits your budget. Endings you list come first, in your order. A budget also drops endings that cost more than it upfront. The cheapest upfront payment and the best 3-year value get their own lines when they differ from the pick. Every checked ending stays on the page.
54
+ - **Prices:** first payment, renewal and three-year cost from first-party registrar price lists, each with its date and label; renewal jumps and premium risk are flagged. Cloudflare's standard at-cost prices come from its official public table ([pricing.registrar.cloudflare.com](https://pricing.registrar.cloudflare.com/)), checked 2026-11-25 and shipped as a dated estimate; they compete with the other registrars, and rows priced there say Needs Cloudflare DNS.
44
55
  - **Trademarks:** live US marks (USPTO). EU (EUIPO) and Norwegian (Patentstyret) marks too when you set their free keys; otherwise, and for WIPO, search links to check yourself. Exact and near-identical live marks in the relevant classes (9, 35 and 42 for software) count the same at every office.
45
56
  - **Meaning:** names that are, contain or sound like a rude word in 14 languages get a note and Check first, never Avoid. Word lists: [LDNOOBW](https://github.com/LDNOOBW/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words), © Shutterstock, CC BY 4.0, adapted (see `clis/domain-check/meaning-words.LICENSE.txt`).
46
57
  - **Apps and rivals:** same-name iOS and Android apps, companies, Wikidata entities and live sites, weighed by their traction.
@@ -54,7 +65,7 @@ GitHub allows 60 anonymous API requests an hour. To check GitHub handles more of
54
65
 
55
66
  For the optional browser fallback, run `npm install domain-hound playwright && npx playwright install chromium` in a project directory and start your MCP client there. Ask for a live shop check to set the `confirm` tool flag, or use `--confirm` with the CLI.
56
67
 
57
- ## Guides
68
+ ### Guides
58
69
 
59
70
  - [Check domain availability](https://domainhound.dev/guides/how-to-check-domain-availability/)
60
71
  - [Find an available startup name](https://domainhound.dev/guides/find-an-available-startup-name/)
@@ -64,15 +75,10 @@ Use `check_domains` for one exact domain or up to 20 names or domains. Use `tria
64
75
 
65
76
  Completed lookups save an HTML page and a Markdown copy in `~/.domain-hound/results/`. The page lists prices, availability and sources for each ending checked. On macOS, naming and batch results open in the background. Windows and Wayland request a background open where the desktop supports it. Exact checks and watch results stay in chat with a file link. Set `DOMAIN_HOUND_OPEN=off` on the MCP server to keep every page closed.
66
77
 
67
- ## Share
78
+ ### Share
68
79
 
69
80
  Use **Share** on the results page to send up to five names. The link carries the names, checked endings, verdicts, prices and check time after the `#`. The browser reads that part locally. Your brief and notes stay out of the link. Anyone with the full link can read the shortlist.
70
81
 
71
- ## Taken names
72
-
73
- - `taken_domain_dossier` checks the registry record, website and public Atom listings. It shows sources, up to three priced alternatives with a quick name screen, and an inquiry draft when useful. Other marketplaces have manual links. The draft stays in the result.
74
- - `watch_domain` checks the registry, expiry and website. To start a free watch, give your assistant the email it should use. Confirm the watch in your inbox. Optional news requires a separate choice in that confirmation.
75
-
76
82
  ## Buy and set up
77
83
 
78
84
  Get a Spaceship price, buy within your limits, and set up DNS in your own account.
@@ -108,7 +114,40 @@ To find the contact ID, use Spaceship's `contacts_list` or read `contacts.regist
108
114
 
109
115
  **Last resort: checkout.** After a valid quote, the answer ends with a Spaceship checkout link, for when Spaceship's MCP cannot be used and nothing was submitted. Check the same term, price limits, privacy and auto-renew before you pay, then ask Domain Hound to verify and set up the domain. After an unclear order there is no checkout link: check your Spaceship account first.
110
116
 
111
- Quotes, DNS plans, order claims and receipts stay in `~/.domain-hound/purchases/`. `DOMAIN_HOUND_PURCHASE_DIR` moves them; a relative path is resolved once, when the server starts.
117
+ ## Watch taken domains
118
+
119
+ - `taken_domain_dossier` checks the registry record, website and public Atom listings. It shows sources, up to three priced alternatives with a quick name screen, and an inquiry draft when useful. Other marketplaces have manual links. The draft stays in the result.
120
+ - `watch_domain` checks the registry, expiry and website. To start a free watch, give your assistant the email it should use. Confirm the watch in your inbox. Optional news requires a separate choice in that confirmation.
121
+
122
+ ## Move a domain to a cheaper shop
123
+
124
+ `move_domain` plans a transfer for any exact domain you own. It reads the same public registry facts and dated list prices as `my_domains` and saves nothing to your list. The plan shows:
125
+
126
+ - the current registrar and its renewal price (a price is "unavailable" when no list price can be trusted)
127
+ - the transfer price at each shop and the total for 3 years. The total adds what the transfer covers (one year for most endings, two for .ai) and the renewals for the remaining years, counted per year
128
+ - the target: Spaceship when it is the cheapest or within $2 a year of the cheapest, otherwise the cheapest shop
129
+ - what blocks a move now: a registration or registry transfer event under 60 days old (gTLDs and .io), a registry lock or pending status, an expiry under 15 days or an expired domain
130
+ - the rules for the ending (ICANN's Transfer Policy, and the .ai and .io terms) and the steps at the current registrar to unlock the domain and get the auth code. Steps link to the official guides for GoDaddy, Namecheap, Squarespace, Cloudflare, Porkbun, Dynadot, Hover, Gandi and IONOS
131
+
132
+ The plan reads a transfer date only from the registry's own `transfer` event, never from the last-changed date.
133
+
134
+ With a Spaceship key (`domains:read`), the plan adds a live transfer quote from Spaceship's pricing API. It is bound to your account, the domain, the current registrar and expiry, the term Spaceship adds, the amount, the regular price (shown when a promotion applies), the renewal and the currency. The quote expires in 10 minutes. `move_domain` with `quote_id` and `max_usd` checks all of that again, plus the blockers, `max_usd` and `DOMAIN_HOUND_MAX_USD`, and stops on any change.
135
+
136
+ **Default: Spaceship's transfer checkout.** Spaceship's MCP ([tool reference](https://www.spaceship.com/knowledgebase/spaceship-mcp/)) has no tool for transfers into Spaceship, and `domain_register` only registers new names. So the answer links to Spaceship's transfer page with the limits to check. You enter the auth code there; it never passes through the chat. If Spaceship's MCP later offers a transfer tool with a preview and a confirmation step, your agent may use it with the same limits.
137
+
138
+ **Opt-in: direct transfer.** This uses the same `DOMAIN_HOUND_DIRECT_PURCHASE=1` and `DOMAIN_HOUND_SPACESHIP_CONTACT_ID` as direct purchase. The key also needs `domains:billing`, `domains:transfer` and `asyncoperations:read`. Preview with a dry run. After your approval, `confirm: true` with the auth code from your private tool input sends one request. It enables high privacy and auto-renew and uses your owner contact for each role. Direct execution requires a standard price, a verified transfer term, an unlocked domain and no pending transfer. Both the promotional and regular upfront prices must fit both limits. Spaceship has no API field for a hard charge limit and sets the final charge. Domain Hound uses the code for the request and omits it from output and local state. A documented refusal releases the local claim. An unclear result keeps the claim and blocks a repeat. `move_domain` with `status: true` follows the transfer without a code.
139
+
140
+ Quotes, transfer quotes, DNS plans, order and transfer claims and receipts stay in `~/.domain-hound/purchases/`. `DOMAIN_HOUND_PURCHASE_DIR` moves them; a relative path is resolved once, when the server starts.
141
+
142
+ ## Keep track of your domains
143
+
144
+ `my_domains` gives one view of every domain you own, wherever you bought it, most urgent first: registrar, expiry and days left, registry status, DNS host, website, certificate, email setup (MX, SPF, DMARC), renewal price and any 3-year saving from moving.
145
+
146
+ - Name the domains you own to check them and save them to a local list of up to 100. Ask again without naming any to recheck the saved list, or ask to remove some.
147
+ - Ask it to find your domains. It lists candidates from a fixed set of public project files (such as `CNAME`, `package.json`, `vercel.json`, `netlify.toml`, Wrangler config and the README) and, with a Spaceship key (`domains:read`), the domains in your Spaceship account. It never opens `.env` or other secret files. Nothing is saved until you confirm which domains are yours.
148
+ - It flags expiry within 30 days, registry and service issues, and potential transfer savings. Renew at your registrar, or use `move_domain` to see how much registration time a transfer adds. The portfolio can also suggest an expiry watch by email.
149
+
150
+ `my_domains` buys, transfers and sends nothing, and stores nothing remotely. Its checks use public registry records, DNS, your sites over HTTPS and HTTP, and dated list prices. The list stays on this computer in `~/.domain-hound/portfolio.json` (`DOMAIN_HOUND_PORTFOLIO_FILE` moves it). The results page is rewritten on each check as `portfolio.html` and `portfolio.md` in the results folder.
112
151
 
113
152
  ## Privacy and lookup hosts
114
153
 
@@ -129,7 +168,7 @@ Domain Hound uses your brief locally. Availability queries use registries and DN
129
168
  | `www.sec.gov`, `tranco-list.eu` | Public company and site lists with no candidate name. |
130
169
  | `index.commoncrawl.org` | Rival domain for a public crawl count. The index list request has no name. |
131
170
  | `api.porkbun.com`, `www.dynadot.com`, `www.gandi.net` | Public price catalogs, sometimes filtered by ending. The standalone exact-price CLI may also ask `data.norges-bank.no` for USD/NOK with no name. |
132
- | `spaceship.dev`, `api.dynadot.com`; `api.porkbun.com` for the standalone exact-price CLI | With configured credentials, the selected domain and the relevant shop credentials. The Spaceship API also gets quote and purchase details, the owner contact ID on a direct order, or DNS records for approved setup. |
171
+ | `spaceship.dev`, `api.dynadot.com`; `api.porkbun.com` for the standalone exact-price CLI | With configured credentials, the selected domain and the relevant shop credentials. Spaceship also gets quote and purchase details, the owner contact ID on a direct order, DNS records for approved setup, or the auth code and owner contact ID for an approved direct transfer. Portfolio discovery uses the Spaceship domain list endpoint. |
133
172
  | `mcp.spaceship.com` | When you use Spaceship's own MCP, your assistant passes the domain and the registration options to Spaceship. |
134
173
  | `www.spaceship.com`, `www.namecheap.com`, `www.dynadot.com`, `www.cloudflare.com` | Optional live browser check sends only the selected domain. Storefront pages can load supporting assets. A manual Spaceship price refresh opens its public catalog without a candidate name. |
135
174
  | `api.search.brave.com` or `google.serper.dev` | Candidate search when you configure a search provider. |
@@ -4,10 +4,10 @@
4
4
  // bought, no shop credentials are used, and no background refresh starts. Every part shares one total deadline.
5
5
  import { classifyComSite } from './com-site.mjs';
6
6
  import { anySignal, cacheDir, readCache } from './cache.mjs';
7
- import { asciiDomain, canRecommend, defaultEndings, domainEnding, fallbackEndings, listQuote, mainstreamEndings, nameCandidates,
8
- premiumRisk, searchCandidates, supportedEndings, unicodeName } from './name-search.mjs';
7
+ import { asciiDomain, canRecommend, choosePick, defaultEndings, domainEnding, listQuote, nameCandidates, premiumRisk, qualityEndings,
8
+ searchCandidates, supportedEndings, unicodeName } from './name-search.mjs';
9
9
  import { bundledCatalog, loadCachedCatalog } from './price-catalog.mjs';
10
- import { bestValue, triageNames } from './triage.mjs';
10
+ import { triageNames } from './triage.mjs';
11
11
  import { bootstrap, bootstrapUrl, documentedWhois, lookupRegistrations, rdapBase, rdapDomainUrl, systemResolveNs } from './registry.mjs';
12
12
  import { saleMarketplace } from './parking.mjs';
13
13
  import { checkListings, marketplaceFor, providers, stopReason, urlBindsDomain } from './marketplaces.mjs';
@@ -20,6 +20,7 @@ const label = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
20
20
  const registrarPriceUrls = {
21
21
  Spaceship: 'https://www.spaceship.com/domain-search/pricing/',
22
22
  Dynadot: 'https://www.dynadot.com/domain/prices?currency=USD',
23
+ Cloudflare: 'https://pricing.registrar.cloudflare.com/',
23
24
  };
24
25
  const priceSourceUrl = (quote, tld) => quote.shop === 'Gandi'
25
26
  ? 'https://www.gandi.net/en/domain/tld/' + encodeURIComponent(tld) + '?currency=USD'
@@ -50,6 +51,9 @@ export function readRdap(data, domain) {
50
51
  if (String(data?.ldhName ?? '').toLowerCase().replace(/\.$/, '') !== domain) return null;
51
52
  const events = Array.isArray(data.events) ? data.events : [];
52
53
  const event = action => iso(events.find(row => row?.eventAction === action)?.eventDate);
54
+ // Multiple transfers can appear. Canonical ISO timestamps sort with the newest first.
55
+ const transferred = events.filter(row => row?.eventAction === 'transfer').map(row => iso(row.eventDate))
56
+ .reduce((latest, date) => date && (!latest || date > latest) ? date : latest, null);
53
57
  const registrar = (Array.isArray(data.entities) ? data.entities : [])
54
58
  .find(entity => Array.isArray(entity?.roles) && entity.roles.includes('registrar'));
55
59
  const card = Array.isArray(registrar?.vcardArray?.[1]) ? registrar.vcardArray[1] : [];
@@ -57,7 +61,8 @@ export function readRdap(data, domain) {
57
61
  const ianaId = (Array.isArray(registrar?.publicIds) ? registrar.publicIds : [])
58
62
  .find(row => /iana/i.test(String(row?.type)))?.identifier;
59
63
  return {
60
- created: event('registration'), expires: event('expiration'), changed: event('last changed'),
64
+ // "transfer" is its own RDAP event action (RFC 9083); "last changed" is never read as a transfer.
65
+ created: event('registration'), expires: event('expiration'), changed: event('last changed'), transferred,
61
66
  registrar: name, registrarIanaId: /^\d{1,6}$/.test(String(ianaId ?? '')) ? String(ianaId) : null,
62
67
  status: (Array.isArray(data.status) ? data.status : [])
63
68
  .filter(value => typeof value === 'string' && /^[a-z ]{3,40}$/i.test(value)).map(normalizeStatus).slice(0, 24),
@@ -116,7 +121,7 @@ export async function registryFacts(domain, { fetcher = globalThis.fetch, resolv
116
121
  registered, checkedAt, source,
117
122
  created: facts.created ?? null,
118
123
  expires: facts.expires ?? iso(basic?.expires) ?? null,
119
- changed: facts.changed ?? null,
124
+ changed: facts.changed ?? null, transferred: facts.transferred ?? null,
120
125
  registrar: facts.registrar ?? null, registrarIanaId: facts.registrarIanaId ?? null,
121
126
  status: facts.status ?? [], nameservers,
122
127
  marketplaceNameservers: saleMarketplace(nameservers),
@@ -304,10 +309,8 @@ export function chooseTrack(registry, listing, outlook) {
304
309
  return 'not-listed';
305
310
  }
306
311
 
307
- // Broker ending order: the anchors, then established mainstream endings (the shared attractiveness tiers). .xyz and
308
- // .tech are a fallback tier, ranked after every mainstream ending however cheap their first year is. Other supported
309
- // endings follow in catalog order.
310
- const brokerEndingOrder = [...new Set([...mainstreamEndings, ...fallbackEndings, ...supportedEndings])];
312
+ // Broker ending order: the shared quality order, then other supported endings in catalog order.
313
+ const brokerEndingOrder = [...new Set([...qualityEndings, ...supportedEndings])];
311
314
  const labelOf = domain => domain.slice(0, domain.indexOf('.'));
312
315
  const threeYearOf = row => Number.isFinite(row?.threeYear) ? row.threeYear : Infinity;
313
316
 
@@ -338,8 +341,9 @@ function variantForms(name) {
338
341
  });
339
342
  }
340
343
 
341
- // Pick the best value for the exact name, a natural .com variant, and the strongest remaining exact ending.
342
- // Fill open slots in ending order, then with additional variants.
344
+ // The shared pick for the exact name (highest-quality ending within $60 over 3 years, else the least paid over 3 years,
345
+ // never .ai by default), a natural .com variant, and the strongest remaining exact ending.
346
+ // Fill open slots in the quality order, then with additional variants.
343
347
  export function pickAlternatives(rows, domain) {
344
348
  const name = labelOf(domain);
345
349
  const forms = variantForms(name);
@@ -354,8 +358,7 @@ export function pickAlternatives(rows, domain) {
354
358
  const picks = [];
355
359
  const open = list => list.filter(row => !picks.some(pick => pick.row === row));
356
360
  const take = (row, role) => { if (row && open([row]).length) picks.push({ row, role }); };
357
- const attractive = exact.filter(row => mainstreamEndings.includes(row.tld));
358
- take(bestValue(attractive) ?? bestValue(exact), 'best-value');
361
+ take(choosePick(exact.map(row => ({ domain: row.domain, now: row.firstPayment ?? null, total: row.threeYear ?? null, row })))?.row, 'pick');
359
362
  take(variants[0], 'variant');
360
363
  for (const row of [...open(exact), ...open(variants)]) {
361
364
  if (picks.length >= 3) break;
@@ -6,7 +6,7 @@ import { promisify } from 'node:util';
6
6
  import { apiShops, cachedSignals, confirmDomain, confirmingShops, lightConfirm } from './confirm.mjs';
7
7
  import { checkDomainSite } from './com-site.mjs';
8
8
  import { appStoreSearchLink, googleSearchLink, nameCheckLines, playSearchLink } from './google-search.mjs';
9
- import { applyLiveSite, asciiDomain, domainEnding, canRecommend, defaultEndings, eligibilityNotes, endingTier, listQuote, mergeQuote, nameCandidates, normalizeName, pickName,
9
+ import { applyLiveSite, asciiDomain, domainEnding, canRecommend, choosePick, defaultEndings, eligibilityNotes, listQuote, mergeQuote, nameCandidates, normalizeName, pickName,
10
10
  premiumRisk, rankName, registrationStatus, searchCandidates, searchName, termCosts, unicodeName, validEligibility, validEndings,
11
11
  withPremiumRisk, withoutListPrice } from './name-search.mjs';
12
12
  import { bundledCatalog, catalogOffers, datedListPrices, isListPriceUsable, loadCachedCatalog, refreshPrices } from './price-catalog.mjs';
@@ -328,15 +328,14 @@ function agentPrice({ firstPayment: now, renewalPayment: renew, threeYear: y3, m
328
328
  const quoteClock = value => typeof value === 'string' ? value.match(/T(\d{2}:\d{2})/)?.[1] ?? null : null;
329
329
 
330
330
  function compactAgentResult(groups, names, complete, checkedAt, batch, rateLimited = false, liveCheck = null,
331
- { eligible, otherEndings, requested = [] } = {}) {
331
+ { eligible, otherEndings, requested = [], budget } = {}) {
332
332
  const buyUrlTemplate = {};
333
333
  const shopCheckWhy = {};
334
334
  const listPrices = {};
335
335
  const checkedEndings = new Set();
336
336
  const byName = new Map();
337
337
  let priceListDate;
338
- let best;
339
- let bestTier;
338
+ const confirmedPicks = [];
340
339
  for (const { name, results } of groups) {
341
340
  const taken = [], resale = [], free = [], shop_check = [], reserved = [], likelyFree = [], likelyTaken = [];
342
341
  for (const row of results) {
@@ -389,19 +388,17 @@ function compactAgentResult(groups, names, complete, checkedAt, batch, rateLimit
389
388
  const at = confirmed ? quoteClock(row.quotedAt ?? row.checkedAt) : null;
390
389
  free.push({ d, s: confirmed ? 'ok' : 'nc', ...(!standard && price), ...(premium && { prem: row.premium ?? true }),
391
390
  ...(at && { at }) });
392
- if (confirmed && !premium && canRecommend(row.tld, eligible) && !premiumRisk(row.domain)) {
391
+ if (confirmed && !premium && canRecommend(row.tld, eligible) && !premiumRisk(row.domain)
392
+ && (budget == null || (row.firstPayment ?? Infinity) <= budget)) {
393
393
  const { now, renew, y3, term, jump } = price;
394
394
  const buyUrl = row.buyUrl ?? shopSearchUrl(shopId, row.domain);
395
- // The cheapest confirmed quote in the most attractive tier is the pick; rows are already sorted by tier, then
396
- // first payment within a name.
397
- const tier = endingTier(row.domain, requested, eligible);
398
- if (best && (bestTier < tier || bestTier === tier && (best.priceNow ?? Infinity) <= (now ?? Infinity))) continue;
399
- bestTier = tier;
400
- best = { domain: row.domain, status: 'free-confirmed', ...(now != null && { priceNow: now }), ...(at && { at }),
401
- ...(renew != null && { renewal: renew }), ...(y3 != null && { threeYear: y3 }),
402
- ...(term && { term }),
403
- ...(jump && { renewalNote: 'Renews at $' + renew.toFixed(2) }),
404
- ...(shop && { shop }), ...(buyUrl && { buyUrl }) };
395
+ // Every confirmed quote competes; the shared pick rule chooses among them below.
396
+ confirmedPicks.push({ domain: row.domain, now: row.firstPayment ?? null, total: row.threeYear ?? null,
397
+ best: { domain: row.domain, status: 'free-confirmed', ...(now != null && { priceNow: now }), ...(at && { at }),
398
+ ...(renew != null && { renewal: renew }), ...(y3 != null && { threeYear: y3 }),
399
+ ...(term && { term }),
400
+ ...(jump && { renewalNote: 'Renews at $' + renew.toFixed(2) }),
401
+ ...(shop && { shop }), ...(buyUrl && { buyUrl }) } });
405
402
  }
406
403
  }
407
404
  const unicode = unicodeName(name);
@@ -411,6 +408,7 @@ function compactAgentResult(groups, names, complete, checkedAt, batch, rateLimit
411
408
  // Subsets of shop_check with a DNS likelihood; only a registry or shop settles them.
412
409
  ...(likelyFree.length && { likely_free: likelyFree }), ...(likelyTaken.length && { likely_taken: likelyTaken }) });
413
410
  }
411
+ const best = choosePick(confirmedPicks, { requested, eligible, budget })?.best;
414
412
  const result = {
415
413
  ...(!batch && names[0].includes('.') && {
416
414
  purchaseAdvice: 'For a purchase request, include this sentence even when the domain is taken: ' + purchaseLine,
@@ -448,17 +446,24 @@ function compactAgentResult(groups, names, complete, checkedAt, batch, rateLimit
448
446
  // the pick is sent to a shop, so no shop sees the other names. DOMAIN_HOUND_SHOP_QUOTES=top4 adds up to three runners-up.
449
447
  export const shopQuoteCount = (env = process.env) => env?.DOMAIN_HOUND_SHOP_QUOTES === 'top4' ? 4 : 1;
450
448
 
451
- // The shop quote goes to the pick: the first preferred ending in order, else the cheapest upfront payment in the most
452
- // attractive tier. explicit lists exact domains the person typed; like preferred endings, they are never demoted.
449
+ // The shop quote goes to the pick (and, with top4, the next picks): the shared pick rule (quality order within $60 over 3 years, or within the cap the
450
+ // person gave), with preferred endings first in the person's order. explicit lists exact domains the person typed; like
451
+ // preferred endings, they rank first. cap is the person's upfront budget: it also drops rows that cost more upfront.
453
452
  export function lightTargets(rows, eligible, count = 1, preferred = [], cap, explicit = []) {
454
453
  const requested = [...preferred, ...explicit];
455
454
  const inScope = rows.filter(row => (!preferred.length || preferred.includes(row.tld))
456
455
  && (cap == null || (row.firstPayment ?? Infinity) <= cap));
457
- const top = preferred.length ? preferred.map(tld => pickName(inScope.filter(row => row.tld === tld), eligible)).find(Boolean)
458
- : pickName(inScope, eligible, requested);
459
- const others = rankName(inScope.filter(row => row !== top && ['probably-free', 'premium'].includes(row.status)
456
+ // The pick first, then the next picks the same rule would make, then any other free or premium row in the quality order.
457
+ const picks = [];
458
+ for (let rest = inScope; picks.length < count;) {
459
+ const next = pickName(rest, eligible, requested, cap);
460
+ if (!next) break;
461
+ picks.push(next);
462
+ rest = rest.filter(row => row !== next);
463
+ }
464
+ const others = rankName(inScope.filter(row => !picks.includes(row) && ['probably-free', 'premium'].includes(row.status)
460
465
  && canRecommend(row.tld, eligible)), requested, eligible);
461
- return [top, ...others].filter(Boolean).slice(0, count);
466
+ return [...picks, ...others].slice(0, count);
462
467
  }
463
468
 
464
469
  export async function agentResult(input, options = {}) {
@@ -545,7 +550,8 @@ export async function agentResult(input, options = {}) {
545
550
  const exactCom = names.length === 1 && names[0].endsWith('.com') ? names[0] : null;
546
551
  const otherEndings = exactCom ? await endingBenchmarks(exactCom, options) : null;
547
552
  const result = compactAgentResult(rankedGroups, names, complete, checkedAt, batch, rateLimited,
548
- options.browser ? liveCheckFor(candidate, quote) : null, { eligible: options.eligible, otherEndings, requested });
553
+ options.browser ? liveCheckFor(candidate, quote) : null, { eligible: options.eligible, otherEndings, requested,
554
+ budget: options.upfrontCap });
549
555
  if (asked.size) result.shopAsked = [...asked];
550
556
  if (options.receipt) result.receiptDetails = rankedGroups.map(({ results, sites }) => ({ endings: results.map(row => ({
551
557
  domain: row.domain, source: row.source, checkedAt: row.checkedAt, priceAt: row.priceCheckedAt,
@@ -46,14 +46,70 @@ export { requestEndings, supportedEndings };
46
46
  export const restrictedEndings = Object.keys(facts).filter(tld => facts[tld].eligibility);
47
47
  const firstCost = row => row.firstPayment ?? Infinity;
48
48
 
49
- // The broker dossier orders mainstream endings first, then .xyz and .tech, then other supported endings.
50
- export const mainstreamEndings = ['com', 'ai', 'si', 'io', 'app', 'dev', 'me', 'co', 'net', 'org'];
51
- export const fallbackEndings = ['xyz', 'tech'];
52
- // Requested endings, exact domains and eligibility opt-ins can compete with the mainstream tier.
53
- export function endingTier(domain, requested = [], eligible = []) {
49
+ // One quality order for every recommender: the CLI and name rankings, the receipt, its share link and the broker
50
+ // dossier. Domain Hound is for AI-native companies, so these endings lead in this order; .xyz and .tech come last.
51
+ // Other supported endings (.net, .org, regional endings) rank after them in catalog order.
52
+ export const qualityEndings = ['com', 'ai', 'io', 'dev', 'app', 'co', 'so', 'me', 'si', 'xyz', 'tech'];
53
+ // The default pick stays within this many dollars of payments due in 3 years; a budget the person gave replaces it.
54
+ export const pickCapUsd = 60;
55
+
56
+ const asked = (domain, requested) => requested.findIndex(value => value === domain || value === domainEnding(domain));
57
+
58
+ // Lower is better. Requested endings and exact domains the person typed come first, in the person's order. A restricted
59
+ // ending the buyer said they qualify for (.no) comes right after .com. Then the quality order, then everything else.
60
+ export function qualityRank(domain, requested = [], eligible = []) {
61
+ const position = asked(domain, requested);
62
+ if (position >= 0) return position - requested.length;
63
+ const order = ['com', ...eligible.filter(tld => restrictedEndings.includes(tld)), ...qualityEndings.slice(1)];
54
64
  const tld = domainEnding(domain);
55
- if (mainstreamEndings.includes(tld) || requested.includes(tld) || requested.includes(domain) || eligible.includes(tld)) return 0;
56
- return fallbackEndings.includes(tld) ? 1 : 2;
65
+ const index = order.indexOf(tld);
66
+ if (index >= 0) return index;
67
+ const other = supportedEndings.indexOf(tld);
68
+ return order.length + (other < 0 ? supportedEndings.length : other);
69
+ }
70
+
71
+ const cents = value => Math.round(value * 100);
72
+ const known = value => typeof value === 'number' && Number.isFinite(value);
73
+
74
+ function fitsCap(option, { budget } = {}) {
75
+ return known(option.total) && cents(option.total) <= cents(budget ?? pickCapUsd);
76
+ }
77
+
78
+ // The one pick rule. options are free, eligible, in-scope rows shaped { domain, now, total } (total = payments due in
79
+ // 3 years). The pick is the highest-quality option within the cap; when none fits, the least paid over 3 years.
80
+ // .ai is never the default: only when the person asked for it or its 3-year total fits the budget they gave.
81
+ export function choosePick(options, { requested = [], eligible = [], budget } = {}) {
82
+ const allowed = options.filter(option => domainEnding(option.domain) !== 'ai' || asked(option.domain, requested) >= 0
83
+ || (budget != null && known(option.total) && cents(option.total) <= cents(budget)));
84
+ const rank = option => qualityRank(option.domain, requested, eligible);
85
+ // A name variation (getexample.com) ranks after every exact ending.
86
+ const byQuality = (a, b) => Number(a.exact === false) - Number(b.exact === false) || rank(a) - rank(b)
87
+ || (a.total ?? Infinity) - (b.total ?? Infinity)
88
+ || (a.now ?? Infinity) - (b.now ?? Infinity) || a.domain.localeCompare(b.domain);
89
+ return allowed.filter(option => fitsCap(option, { budget })).sort(byQuality)[0]
90
+ ?? lowestTotal(allowed, rank);
91
+ }
92
+
93
+ // The least paid over 3 years; the cheaper first payment, then quality, breaks a tie.
94
+ export function lowestTotal(options, rank = option => qualityRank(option.domain)) {
95
+ return options.filter(option => known(option.total)).sort((a, b) => cents(a.total) - cents(b.total)
96
+ || (a.now ?? Infinity) - (b.now ?? Infinity) || rank(a) - rank(b) || a.domain.localeCompare(b.domain))[0];
97
+ }
98
+
99
+ // The cheapest upfront payment; quality breaks a tie.
100
+ export function lowestUpfront(options, rank = option => qualityRank(option.domain)) {
101
+ return options.filter(option => known(option.now)).sort((a, b) => cents(a.now) - cents(b.now) || rank(a) - rank(b)
102
+ || a.domain.localeCompare(b.domain))[0];
103
+ }
104
+
105
+ // Across names, prefer quality inside the cap and the lowest three-year total above it.
106
+ export function comparePicks(a, b, context = {}) {
107
+ const aFits = fitsCap(a, context);
108
+ const bFits = fitsCap(b, context);
109
+ const rank = qualityRank(a.domain, context.requested, context.eligible) - qualityRank(b.domain, context.requested, context.eligible);
110
+ const total = (a.total ?? Infinity) - (b.total ?? Infinity);
111
+ return Number(bFits) - Number(aFits) || (aFits ? rank || total : total || rank)
112
+ || (a.now ?? Infinity) - (b.now ?? Infinity);
57
113
  }
58
114
 
59
115
  export function validEligibility(eligible) {
@@ -159,7 +215,7 @@ export function termCosts(tld, price, renewal) {
159
215
  };
160
216
  }
161
217
 
162
- // Exact names first, then by attractiveness tier, then by upfront payment (including any minimum term).
218
+ // Exact names first, then by the quality order, then by upfront payment (including any minimum term).
163
219
  export function rankName(rows, requested = [], eligible = []) {
164
220
  return rows.map(row => {
165
221
  const { tld, exact, status, price = null, renewal = null } = row;
@@ -170,19 +226,17 @@ export function rankName(rows, requested = [], eligible = []) {
170
226
  return { ...row, ...termCosts(tld, price, renewal), reason, terms: facts[tld] ?? null,
171
227
  renewalJump: price != null && renewal > 2 * price };
172
228
  }).sort((a, b) => Number(b.exact) - Number(a.exact)
173
- || endingTier(a.domain, requested, eligible) - endingTier(b.domain, requested, eligible) || firstCost(a) - firstCost(b)
229
+ || qualityRank(a.domain, requested, eligible) - qualityRank(b.domain, requested, eligible) || firstCost(a) - firstCost(b)
174
230
  || supportedEndings.indexOf(a.tld) - supportedEndings.indexOf(b.tld) || a.domain.localeCompare(b.domain));
175
231
  }
176
232
 
177
- // The cheapest upfront payment within the most attractive tier that has a recommendable free row.
178
- export function pickName(rows, eligible, requested = []) {
179
- const tier = row => endingTier(row.domain, requested, eligible);
180
- return rows.reduce((best, row) => {
181
- if (!canRecommend(row.tld, eligible) || premiumRisk(row.domain) || !['probably-free', 'confirmed'].includes(row.status)) return best;
182
- if (best && tier(row) !== tier(best)) return tier(row) < tier(best) ? row : best;
183
- return !best || firstCost(row) < firstCost(best) ||
184
- (firstCost(row) === firstCost(best) && row.exact && !best.exact) ? row : best;
185
- }, undefined);
233
+ // The pick among recommendable free rows: the shared pick rule over upfront payment and payments due in 3 years.
234
+ // budget is the person's explicit cap, when given.
235
+ export function pickName(rows, eligible, requested = [], budget) {
236
+ const options = rows.filter(row => canRecommend(row.tld, eligible) && !premiumRisk(row.domain)
237
+ && ['probably-free', 'confirmed'].includes(row.status))
238
+ .map(row => ({ domain: row.domain, exact: row.exact !== false, now: row.firstPayment ?? null, total: row.threeYear ?? null, row }));
239
+ return choosePick(options, { requested, eligible, budget })?.row;
186
240
  }
187
241
 
188
242
  export function registrationStatus(registry) {
@@ -7,10 +7,11 @@ import { cacheDir, readCache, writeCache } from './cache.mjs';
7
7
  import { withShopPages } from './confirm.mjs';
8
8
  import { catalogPrice, dynadotOffer, offer, shops } from './prices.mjs';
9
9
 
10
- // The endings every bare name is checked on. The first ten are the 0.1.4 set; .net, .org, .xyz and .tech joined in 0.1.5.
11
- export const targetEndings = ['com', 'ai', 'io', 'me', 'co', 'dev', 'app', 'si', 'so', 'no', 'net', 'org', 'xyz', 'tech'];
10
+ // The endings every bare name is checked on. The first ten are the 0.1.4 set; .xyz and .tech joined in 0.1.5.
11
+ // .net and .org left the defaults in 0.1.8 (few AI-native companies want them); they stay checkable on request.
12
+ export const targetEndings = ['com', 'ai', 'io', 'me', 'co', 'dev', 'app', 'si', 'so', 'no', 'xyz', 'tech'];
12
13
  // Checked only when the person asks for them (or names them in endings).
13
- export const requestEndings = ['sh', 'gg', 'inc', 'studio', 'se', 'dk', 'de', 'uk', 'co.uk', 'eu'];
14
+ export const requestEndings = ['net', 'org', 'sh', 'gg', 'inc', 'studio', 'se', 'dk', 'de', 'uk', 'co.uk', 'eu'];
14
15
  export const supportedEndings = [...targetEndings, ...requestEndings];
15
16
  // A saved or bundled catalog must cover these; newer endings are priced once a refresh has them.
16
17
  const coreEndings = targetEndings.slice(0, 10);
@@ -19,6 +20,10 @@ const spaceshipEndings = coreEndings.filter(tld => !otherEndings.includes(tld));
19
20
  const filename = 'prices.json';
20
21
  const day = 86_400_000;
21
22
  const primaryShops = ['spaceship', 'porkbun', 'dynadot'];
23
+ // Registrars priced only from the checked snapshot, never fetched at run time. Cloudflare's standard registration and
24
+ // renewal prices come from its official public table (pricing.registrar.cloudflare.com), checked on the snapshot date.
25
+ // They stay a dated estimate and need Cloudflare DNS.
26
+ export const snapshotShops = ['cloudflare'];
22
27
  const automaticShops = ['porkbun', 'dynadot'];
23
28
  const refreshMarker = 'price-refresh.attempt';
24
29
  const pricingPage = 'https://www.spaceship.com/domain-search/pricing/';
@@ -30,7 +35,7 @@ function validPrice(row, shop) {
30
35
 
31
36
  function validSource(id, prices) {
32
37
  const entries = Object.entries(prices ?? {});
33
- const required = id === 'spaceship' ? spaceshipEndings : id === 'gandi' ? [] : ['com', 'io', 'me'];
38
+ const required = id === 'spaceship' ? spaceshipEndings : ['gandi', ...snapshotShops].includes(id) ? [] : ['com', 'io', 'me'];
34
39
  return entries.length > 0 && required.every(tld => Object.hasOwn(prices, tld)) &&
35
40
  entries.every(([tld, row]) => supportedEndings.includes(tld) && validPrice(row, shops[id].name));
36
41
  }
@@ -45,7 +50,7 @@ export function validCatalog(value) {
45
50
  return coreEndings.every(tld => validPrice(value.prices?.[tld], otherEndings.includes(tld) ? 'Gandi' : 'Spaceship'));
46
51
  }
47
52
  return Object.keys(value.catalogs).length > 0 && Object.entries(value.catalogs).every(([id, source]) =>
48
- [...primaryShops, 'gandi'].includes(id) && validDate(source.checkedAt) && validSource(id, source.prices));
53
+ [...primaryShops, 'gandi', ...snapshotShops].includes(id) && validDate(source.checkedAt) && validSource(id, source.prices));
49
54
  }
50
55
 
51
56
  export async function loadCachedCatalog(directory = cacheDir) {
@@ -90,11 +95,22 @@ export const bundledCatalog = readBundledCatalog();
90
95
  // 2. otherwise the bundled snapshot as a dated estimate, or older cached rows if they are at least as new.
91
96
  // Without a snapshot for the ending, an older cached price is never shown. Rows from the snapshot carry
92
97
  // bundled: true. A live or shop-confirmed quote replaces all of these later.
98
+ // Snapshot-only registrars (Cloudflare) join by registrar: a fresh cached row for that registrar wins, else its dated
99
+ // snapshot row. Fresh data from the other shops never discards them.
93
100
  export function datedListPrices(catalog, tld, now = new Date(), bundled = bundledCatalog) {
94
- const cached = listedPrices(catalog, tld);
101
+ const cachedAll = listedPrices(catalog, tld);
102
+ const shippedAll = listedPrices(bundled, tld).map(row => ({ ...row, bundled: true }));
103
+ const refreshable = rows => rows.filter(row => !snapshotShops.includes(row.id));
104
+ const pinned = snapshotShops.flatMap(id => {
105
+ const row = cachedAll.find(item => item.id === id && isListPriceUsable(item.checkedAt, now)) ?? shippedAll.find(item => item.id === id);
106
+ return row ? [row] : [];
107
+ });
108
+ return [...shopListPrices(refreshable(cachedAll), refreshable(shippedAll), now), ...pinned];
109
+ }
110
+
111
+ function shopListPrices(cached, snapshot, now) {
95
112
  const fresh = cached.filter(row => isListPriceUsable(row.checkedAt, now));
96
113
  if (fresh.length) return fresh;
97
- const snapshot = listedPrices(bundled, tld).map(row => ({ ...row, bundled: true }));
98
114
  if (!snapshot.length) return [];
99
115
  const older = cached.filter(row => now - Date.parse(row.checkedAt) >= 0);
100
116
  const newest = rows => rows.reduce((date, row) => row.checkedAt > date ? row.checkedAt : date, '');
@@ -154,6 +170,9 @@ export function listedPrices(catalog, tld) {
154
170
  if (!listed.length && sources.gandi?.prices[tld]) {
155
171
  listed.push({ ...sources.gandi.prices[tld], id: 'gandi', checkedAt: sources.gandi.checkedAt });
156
172
  }
173
+ for (const id of snapshotShops) {
174
+ if (sources[id]?.prices[tld]) listed.push({ ...sources[id].prices[tld], id, checkedAt: sources[id].checkedAt });
175
+ }
157
176
  return listed;
158
177
  }
159
178