domain-hound 0.1.6 → 0.1.7

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.6",
7
+ "version": "0.1.7",
8
8
  "source": { "source": "local", "path": "./" },
9
9
  "policy": { "installation": "AVAILABLE", "authentication": "ON_INSTALL" },
10
10
  "category": "Productivity"
@@ -5,7 +5,7 @@
5
5
  "plugins": [
6
6
  {
7
7
  "name": "domain-hound",
8
- "version": "0.1.6",
8
+ "version": "0.1.7",
9
9
  "source": "./",
10
10
  "description": "Check domains, compare registrar prices, and screen product names."
11
11
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "domain-hound",
3
3
  "displayName": "Domain Hound",
4
- "version": "0.1.6",
4
+ "version": "0.1.7",
5
5
  "description": "Check domain availability and prices, and screen product names, from your AI assistant.",
6
6
  "author": {
7
7
  "name": "Lars Hvinden"
package/README.md CHANGED
@@ -151,7 +151,7 @@ Run `node scripts/canary.mjs` to check live registries, the Spotify name screen,
151
151
 
152
152
  ## Releases
153
153
 
154
- `.github/workflows/publish.yml` publishes a matching `v*` version tag to npm with Trusted Publishing and provenance. It then waits until the npm CDN serves the new tarball, runs `npx -y domain-hound@<version>` as a `tools/list` smoke test, and publishes `server.json` to the MCP Registry. The registry step needs the repository secret `MCP_REGISTRY_PRIVATE_KEY` (the hex Ed25519 private key whose public key is served at `https://domainhound.dev/.well-known/mcp-registry-auth`); without it the run ends with a notice and nothing else changes. Do not open the plain tarball URL before the workflow reports it live: the CDN caches a 404. After the first manual publish, open the package settings on npm and add GitHub Actions as a trusted publisher. Use owner `lars-hv`, repository `domain-hound`, workflow `publish.yml`, and allow `npm publish`. Use the workflow for the next unpublished version. [npm Trusted Publishing setup](https://docs.npmjs.com/trusted-publishers/)
154
+ `.github/workflows/publish.yml` publishes a matching `v*` version tag to npm with Trusted Publishing and provenance. It then waits until `npm view domain-hound@<version>`, run with a new empty npm cache each time, lists the version three times in a row (up to 15 minutes), runs `npx -y domain-hound@<version>` as a `tools/list` smoke test (retried with a fresh cache for up to 10 minutes while npx still reports ETARGET or E404, because npx can see staler package metadata than `npm view`), and publishes `server.json` to the MCP Registry only after that smoke passes. The registry step needs the repository secret `MCP_REGISTRY_PRIVATE_KEY` (the hex Ed25519 private key whose public key is served at `https://domainhound.dev/.well-known/mcp-registry-auth`); without it the run ends with a notice and nothing else changes. Do not open the plain tarball URL before the smoke test passes: the CDN caches a 404. After the first manual publish, open the package settings on npm and add GitHub Actions as a trusted publisher. Use owner `lars-hv`, repository `domain-hound`, workflow `publish.yml`, and allow `npm publish`. Use the workflow for the next unpublished version. [npm Trusted Publishing setup](https://docs.npmjs.com/trusted-publishers/)
155
155
 
156
156
  To refresh the bundled list prices before a release, run `npm run snapshot-prices`. It copies only the local `prices.json` price list.
157
157
 
@@ -4,8 +4,8 @@
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, listQuote, nameCandidates, premiumRisk, searchCandidates,
8
- supportedEndings, unicodeName } from './name-search.mjs';
7
+ import { asciiDomain, canRecommend, defaultEndings, domainEnding, fallbackEndings, listQuote, mainstreamEndings, nameCandidates,
8
+ premiumRisk, searchCandidates, supportedEndings, unicodeName } from './name-search.mjs';
9
9
  import { bundledCatalog, loadCachedCatalog } from './price-catalog.mjs';
10
10
  import { bestValue, triageNames } from './triage.mjs';
11
11
  import { bootstrap, bootstrapUrl, documentedWhois, lookupRegistrations, rdapBase, rdapDomainUrl, systemResolveNs } from './registry.mjs';
@@ -304,10 +304,10 @@ export function chooseTrack(registry, listing, outlook) {
304
304
  return 'not-listed';
305
305
  }
306
306
 
307
- // Broker ending order: the anchors, then established mainstream endings. .xyz and .tech are a fallback tier, ranked
308
- // after every mainstream ending however cheap their first year is. Other supported endings follow in catalog order.
309
- const brokerEndings = ['com', 'ai', 'si', 'io', 'app', 'dev', 'me', 'co', 'net', 'org'];
310
- const brokerEndingOrder = [...new Set([...brokerEndings, 'xyz', 'tech', ...supportedEndings])];
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])];
311
311
  const labelOf = domain => domain.slice(0, domain.indexOf('.'));
312
312
  const threeYearOf = row => Number.isFinite(row?.threeYear) ? row.threeYear : Infinity;
313
313
 
@@ -354,7 +354,7 @@ export function pickAlternatives(rows, domain) {
354
354
  const picks = [];
355
355
  const open = list => list.filter(row => !picks.some(pick => pick.row === row));
356
356
  const take = (row, role) => { if (row && open([row]).length) picks.push({ row, role }); };
357
- const attractive = exact.filter(row => brokerEndings.includes(row.tld));
357
+ const attractive = exact.filter(row => mainstreamEndings.includes(row.tld));
358
358
  take(bestValue(attractive) ?? bestValue(exact), 'best-value');
359
359
  take(variants[0], 'variant');
360
360
  for (const row of [...open(exact), ...open(variants)]) {
@@ -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, listQuote, mergeQuote, nameCandidates, normalizeName, pickName,
9
+ import { applyLiveSite, asciiDomain, domainEnding, canRecommend, defaultEndings, eligibilityNotes, endingTier, 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,7 +328,7 @@ 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 } = {}) {
331
+ { eligible, otherEndings, requested = [] } = {}) {
332
332
  const buyUrlTemplate = {};
333
333
  const shopCheckWhy = {};
334
334
  const listPrices = {};
@@ -336,6 +336,7 @@ function compactAgentResult(groups, names, complete, checkedAt, batch, rateLimit
336
336
  const byName = new Map();
337
337
  let priceListDate;
338
338
  let best;
339
+ let bestTier;
339
340
  for (const { name, results } of groups) {
340
341
  const taken = [], resale = [], free = [], shop_check = [], reserved = [], likelyFree = [], likelyTaken = [];
341
342
  for (const row of results) {
@@ -391,8 +392,11 @@ function compactAgentResult(groups, names, complete, checkedAt, batch, rateLimit
391
392
  if (confirmed && !premium && canRecommend(row.tld, eligible) && !premiumRisk(row.domain)) {
392
393
  const { now, renew, y3, term, jump } = price;
393
394
  const buyUrl = row.buyUrl ?? shopSearchUrl(shopId, row.domain);
394
- // The cheapest confirmed quote is the pick; rows are already sorted by first payment within a name.
395
- if (best && (best.priceNow ?? Infinity) <= (now ?? Infinity)) continue;
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;
396
400
  best = { domain: row.domain, status: 'free-confirmed', ...(now != null && { priceNow: now }), ...(at && { at }),
397
401
  ...(renew != null && { renewal: renew }), ...(y3 != null && { threeYear: y3 }),
398
402
  ...(term && { term }),
@@ -444,13 +448,16 @@ function compactAgentResult(groups, names, complete, checkedAt, batch, rateLimit
444
448
  // 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.
445
449
  export const shopQuoteCount = (env = process.env) => env?.DOMAIN_HOUND_SHOP_QUOTES === 'top4' ? 4 : 1;
446
450
 
447
- export function lightTargets(rows, eligible, count = 1, preferred = [], cap) {
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.
453
+ export function lightTargets(rows, eligible, count = 1, preferred = [], cap, explicit = []) {
454
+ const requested = [...preferred, ...explicit];
448
455
  const inScope = rows.filter(row => (!preferred.length || preferred.includes(row.tld))
449
456
  && (cap == null || (row.firstPayment ?? Infinity) <= cap));
450
457
  const top = preferred.length ? preferred.map(tld => pickName(inScope.filter(row => row.tld === tld), eligible)).find(Boolean)
451
- : pickName(inScope, eligible);
458
+ : pickName(inScope, eligible, requested);
452
459
  const others = rankName(inScope.filter(row => row !== top && ['probably-free', 'premium'].includes(row.status)
453
- && canRecommend(row.tld, eligible)));
460
+ && canRecommend(row.tld, eligible)), requested, eligible);
454
461
  return [top, ...others].filter(Boolean).slice(0, count);
455
462
  }
456
463
 
@@ -484,7 +491,8 @@ export async function agentResult(input, options = {}) {
484
491
  const rows = fast.groups.flatMap(group => group.results);
485
492
  const targets = domain ? rows.filter(row => canRecommend(row.tld, options.eligible)
486
493
  && ['probably-free', 'check-at-shop', 'premium'].includes(row.status))
487
- : lightTargets(rows, options.eligible, shopQuoteCount(options.env ?? process.env), options.preferredEndings, options.upfrontCap);
494
+ : lightTargets(rows, options.eligible, shopQuoteCount(options.env ?? process.env), options.preferredEndings, options.upfrontCap,
495
+ [...exact]);
488
496
  const [candidate] = targets;
489
497
  // A Google retry can settle every row that the first pass left waiting.
490
498
  let complete = fast.complete || !rows.some(row => row.registryReason === 'Registry lookup timed out');
@@ -530,13 +538,14 @@ export async function agentResult(input, options = {}) {
530
538
  complete = false;
531
539
  }
532
540
  const apply = row => quotes.has(row.domain) ? mergeQuote(row, quotes.get(row.domain)) : row;
533
- const rankedGroups = fast.groups.map(group => ({ ...group, results: rankName(group.results.map(apply)) }));
541
+ const requested = [...(options.preferredEndings ?? []), ...exact];
542
+ const rankedGroups = fast.groups.map(group => ({ ...group, results: rankName(group.results.map(apply), requested, options.eligible) }));
534
543
  const checkedAt = options.now?.toISOString() ?? new Date().toISOString();
535
544
  // An exact .com gets the standard list prices of the other endings as one benchmark line, with no extra lookups.
536
545
  const exactCom = names.length === 1 && names[0].endsWith('.com') ? names[0] : null;
537
546
  const otherEndings = exactCom ? await endingBenchmarks(exactCom, options) : null;
538
547
  const result = compactAgentResult(rankedGroups, names, complete, checkedAt, batch, rateLimited,
539
- options.browser ? liveCheckFor(candidate, quote) : null, { eligible: options.eligible, otherEndings });
548
+ options.browser ? liveCheckFor(candidate, quote) : null, { eligible: options.eligible, otherEndings, requested });
540
549
  if (asked.size) result.shopAsked = [...asked];
541
550
  if (options.receipt) result.receiptDetails = rankedGroups.map(({ results, sites }) => ({ endings: results.map(row => ({
542
551
  domain: row.domain, source: row.source, checkedAt: row.checkedAt, priceAt: row.priceCheckedAt,
@@ -624,7 +633,7 @@ async function retryGoogle(fast, remaining, options) {
624
633
  for (const key of ['price', 'renewal', 'shop', 'priceSource', 'priceCheckedAt', 'buyUrl']) delete settled[key];
625
634
  return price == null ? settled : { ...settled, listPrice: { shop, checkedAt: priceCheckedAt,
626
635
  ...termCosts(row.tld, price, renewal), renewalJump: renewal > 2 * price } };
627
- }));
636
+ }), options.preferredEndings, options.eligible);
628
637
  }
629
638
  return limited;
630
639
  }
@@ -46,6 +46,16 @@ 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 = []) {
54
+ 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;
57
+ }
58
+
49
59
  export function validEligibility(eligible) {
50
60
  return Array.isArray(eligible) && new Set(eligible).size === eligible.length
51
61
  && eligible.every(tld => restrictedEndings.includes(tld));
@@ -149,7 +159,8 @@ export function termCosts(tld, price, renewal) {
149
159
  };
150
160
  }
151
161
 
152
- export function rankName(rows) {
162
+ // Exact names first, then by attractiveness tier, then by upfront payment (including any minimum term).
163
+ export function rankName(rows, requested = [], eligible = []) {
153
164
  return rows.map(row => {
154
165
  const { tld, exact, status, price = null, renewal = null } = row;
155
166
  const reason = status === 'premium' ? row.premium === 'risk' ? 'May be premium' : 'Premium price' : status === 'reserved' ? 'Not offered for registration'
@@ -158,13 +169,17 @@ export function rankName(rows) {
158
169
  : exact ? 'Exact name' : 'Name variation';
159
170
  return { ...row, ...termCosts(tld, price, renewal), reason, terms: facts[tld] ?? null,
160
171
  renewalJump: price != null && renewal > 2 * price };
161
- }).sort((a, b) => Number(b.exact) - Number(a.exact) || firstCost(a) - firstCost(b)
172
+ }).sort((a, b) => Number(b.exact) - Number(a.exact)
173
+ || endingTier(a.domain, requested, eligible) - endingTier(b.domain, requested, eligible) || firstCost(a) - firstCost(b)
162
174
  || supportedEndings.indexOf(a.tld) - supportedEndings.indexOf(b.tld) || a.domain.localeCompare(b.domain));
163
175
  }
164
176
 
165
- export function pickName(rows, eligible) {
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);
166
180
  return rows.reduce((best, row) => {
167
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;
168
183
  return !best || firstCost(row) < firstCost(best) ||
169
184
  (firstCost(row) === firstCost(best) && row.exact && !best.exact) ? row : best;
170
185
  }, undefined);
@@ -356,7 +371,7 @@ export async function searchCandidates(groups, options = {}) {
356
371
  if (status === 'reserved') return withoutListPrice(settled, 'reserved', lookup.reason);
357
372
  const signal = status === 'taken' ? null : signals.get(row.domain);
358
373
  return signal ? mergeQuote(settled, signal) : settled;
359
- }));
374
+ }), options.preferredEndings, options.eligible);
360
375
  const checkedSites = {};
361
376
  for (const row of rows) {
362
377
  const site = sites.get(row.domain)?.result;
@@ -391,7 +406,7 @@ export async function searchName(input, options = {}) {
391
406
  if (options.eligible !== undefined && !validEligibility(options.eligible)) return { error: 'Eligible endings must list supported restricted endings, such as no.' };
392
407
  const { groups: [{ results, comSite }], priceDate, ms } = await searchCandidates(
393
408
  [{ name, candidates: nameCandidates(name, options) }], options);
394
- return { name, hero: pickName(results, options.eligible)?.domain ?? null,
409
+ return { name, hero: pickName(results, options.eligible, options.preferredEndings)?.domain ?? null,
395
410
  ...(options.eligible?.length && { eligible: options.eligible }), results, priceDate, comSite,
396
411
  checkedAt: options.now?.toISOString() ?? new Date().toISOString(), ms };
397
412
  }
@@ -1,4 +1,4 @@
1
- import { canRecommend, defaultEndings, eligibilityNotes, nameCandidates, normalizeName, searchCandidates, searchKey,
1
+ import { canRecommend, defaultEndings, eligibilityNotes, endingTier, nameCandidates, normalizeName, searchCandidates, searchKey,
2
2
  validEligibility, validEndings } from './name-search.mjs';
3
3
  import { shopSearchUrl } from './prices.mjs';
4
4
  import { checkHandles, compactText, handleSearches, letters, markOrder, searchApps, searchEntities, searchMarks, trademarkSearches }
@@ -279,6 +279,8 @@ export async function triageNames(inputs, options = {}) {
279
279
  if (options.endings && !validEndings(options.endings)) return { error: 'Choose supported domain endings.' };
280
280
  if (options.eligible !== undefined && !validEligibility(options.eligible)) return { error: 'Eligible endings must list supported restricted endings, such as no.' };
281
281
  const endings = options.endings ?? defaultEndings;
282
+ const preferred = options.preferredEndings ?? [];
283
+ const requestedEndings = [...preferred, ...(options.eligible ?? [])];
282
284
  const websiteEndings = [...new Set([...endings, ...coreWebsiteEndings])];
283
285
  // Each name has its DNS label (punycode for æøå) for domains, and a Latin key for the rival, app and mark sources.
284
286
  const names = new Map();
@@ -440,7 +442,9 @@ export async function triageNames(inputs, options = {}) {
440
442
  const rows = domains.groups.map(({ name, results, sites }, index) => {
441
443
  const requested = results.filter(row => endings.includes(row.tld));
442
444
  const available = results.filter(row => row.status === 'probably-free' && endings.includes(row.tld));
443
- const recommendable = available.filter(row => canRecommend(row.tld, options.eligible));
445
+ const recommendable = available.filter(row => canRecommend(row.tld, options.eligible)
446
+ && (!preferred.length || preferred.includes(row.tld)));
447
+ if (preferred.length) recommendable.sort((a, b) => preferred.indexOf(a.tld) - preferred.indexOf(b.tld));
444
448
  const [best] = recommendable;
445
449
  const social = socialByName.get(keys.get(name)) ?? null;
446
450
  const domainFields = {
@@ -599,13 +603,13 @@ export async function triageNames(inputs, options = {}) {
599
603
  row.checks = options.compact ? null
600
604
  : nameCheckLines(row).map(({ label, text, link }) => label + ': ' + text + ' · ' + link);
601
605
  }
602
- for (const row of googleCandidates(rows)) row.google.search = true;
606
+ for (const row of googleCandidates(rows, requestedEndings)) row.google.search = true;
603
607
  const sourcesSummary = Object.fromEntries(Object.entries(counts).map(([source, answered]) =>
604
608
  [source, Math.round(100 * answered / Math.min(names.size, screenLimit))]));
605
609
  const receiptDetails = options.receipt ? structuredClone(rows.map(({ competition, details, traction, google, reason, meaning, _receiptEndings, _handles, _waiting }) =>
606
610
  ({ competition, details, traction, google, reason, meaning, endings: _receiptEndings, handles: _handles,
607
611
  ...(_waiting?.().length && { waiting: _waiting() }) }))) : null;
608
- const result = packTriage(rows, sourcesSummary, options.compact, endings, options.eligible);
612
+ const result = packTriage(rows, sourcesSummary, options.compact, endings, options.eligible, requestedEndings);
609
613
  // The first pass of a follow-up run says more checks are coming.
610
614
  if (answerBy && waiting.size) result.followUp = true;
611
615
  if (options.receipt) {
@@ -641,8 +645,8 @@ function compactHandles(entries) {
641
645
  }
642
646
 
643
647
  // The first three ranked names, filled from the screened names in input order when fewer than three rank.
644
- export function googleCandidates(rows) {
645
- const picked = rankedRows(rows).slice(0, 3);
648
+ export function googleCandidates(rows, requested) {
649
+ const picked = rankedRows(rows, requested).slice(0, 3);
646
650
  for (const row of rows) if (picked.length < 3 && !picked.includes(row)) picked.push(row);
647
651
  return picked;
648
652
  }
@@ -670,17 +674,28 @@ export function bestValue(options) {
670
674
  || (row.threeYear === best.threeYear && row.firstPayment < best.firstPayment) ? row : best, undefined);
671
675
  }
672
676
 
673
- function rankedRows(rows) {
677
+ // Best value within the most attractive tier that has an in-scope row. When that tier's rows lack a usable three-year
678
+ // total, there is no best value yet (it needs a shop quote); a fallback ending never takes over silently.
679
+ export function tierBestValue(options, requested = []) {
680
+ const tier = Math.min(...options.map(row => endingTier(row.domain, requested)));
681
+ return bestValue(options.filter(row => endingTier(row.domain, requested) === tier));
682
+ }
683
+
684
+ // A name's pick is its first recommendable row (ranked by tier, then upfront payment); a name without one sorts last.
685
+ const pickTier = (row, requested) => row._recommendable[0] ? endingTier(row._recommendable[0].domain, requested) : Infinity;
686
+
687
+ function rankedRows(rows, requested = []) {
674
688
  const order = { 'No conflict found': 0, 'Check first': 1 };
675
689
  return rows.filter(row => row.verdict !== 'Avoid').sort((a, b) => order[a.verdict] - order[b.verdict]
690
+ || pickTier(a, requested) - pickTier(b, requested)
676
691
  || (a._recommendable[0]?.firstPayment ?? Infinity) - (b._recommendable[0]?.firstPayment ?? Infinity));
677
692
  }
678
693
 
679
- function topChoices(rows) {
680
- return rankedRows(rows).slice(0, 3)
694
+ function topChoices(rows, requested) {
695
+ return rankedRows(rows, requested).slice(0, 3)
681
696
  .map(({ name, verdict, reason, _recommendable }) => {
682
697
  const [best] = _recommendable;
683
- const value = bestValue(_recommendable);
698
+ const value = tierBestValue(_recommendable, requested);
684
699
  return {
685
700
  name, verdict, reason, domain: best?.domain ?? null, ending: best?.tld ?? null,
686
701
  now: best?.firstPayment ?? null, renew: best?.renewalPayment ?? null, term: best?.minimumYears ?? null,
@@ -691,9 +706,9 @@ function topChoices(rows) {
691
706
  }
692
707
 
693
708
  // Share each ending's standard price once and keep only per-name differences.
694
- function packTriage(rows, sources, compact, endings, eligible) {
709
+ function packTriage(rows, sources, compact, endings, eligible, requested = []) {
695
710
  const prices = {};
696
- const top = topChoices(rows);
711
+ const top = topChoices(rows, requested);
697
712
  // Handle states for the top names: taken, not_found (no public profile found) or check (check yourself).
698
713
  const handles = Object.fromEntries(rows.filter(row => row._social).map(row => [row.name, row._social]));
699
714
  const names = rows.map(({ _free, _recommendable, _mark, _googleExplained, _receiptEndings, _handles, _social, _waiting, ...row }) => {
@@ -704,7 +719,7 @@ function packTriage(rows, sources, compact, endings, eligible) {
704
719
  if (!prices[option.tld]) prices[option.tld] = entry;
705
720
  else if (JSON.stringify(prices[option.tld]) !== JSON.stringify(entry)) own[option.tld] = entry;
706
721
  }
707
- return { ...row, free: _free.map(option => option.tld), own, bestValue: bestValue(_recommendable)?.tld ?? null };
722
+ return { ...row, free: _free.map(option => option.tld), own, bestValue: tierBestValue(_recommendable, requested)?.tld ?? null };
708
723
  });
709
724
  const result = { top, names, prices, sources, eligibility: eligibilityNotes(endings),
710
725
  ...(Object.keys(handles).length && { handles }),
package/display.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { shopSearchUrl, shops } from './clis/domain-check/prices.mjs';
2
2
  import { isSearchLink, nameCheckLines } from './clis/domain-check/google-search.mjs';
3
- import { canRecommend, eligibilityNeed, normalizeName, premiumRisk, unicodeName } from './clis/domain-check/name-search.mjs';
3
+ import { canRecommend, eligibilityNeed, endingTier, normalizeName, premiumRisk, unicodeName } from './clis/domain-check/name-search.mjs';
4
4
  import { purchaseLine } from './clis/domain-check/naming-method.mjs';
5
5
 
6
6
  export { purchaseLine, showAsIs } from './clis/domain-check/naming-method.mjs';
@@ -276,14 +276,19 @@ function groupRows(rows, linesFor) {
276
276
  return [...groups.values()];
277
277
  }
278
278
 
279
- // For one bare name: the cheapest first payment and the best three-year value among the endings this buyer can register.
280
- function choiceLines(row, listPrices, eligible) {
281
- const options = (row.free ?? []).flatMap(option => {
279
+ // For one bare name: the cheapest first payment and the best three-year value among the endings this buyer can register,
280
+ // both within the most attractive tier that has a free ending (fallback endings only when nothing else is free).
281
+ function choiceLines(row, listPrices, eligible, preferred = []) {
282
+ const free = (row.free ?? []).flatMap(option => {
282
283
  const domain = option.d.includes('.') ? option.d : row.name + '.' + option.d;
283
- if (option.s === 'prem' || option.prem || premiumRisk(domain) || ineligible(suffix(domain), eligible)) return [];
284
+ const ending = suffix(domain);
285
+ if (option.s === 'prem' || option.prem || premiumRisk(domain) || ineligible(ending, eligible)
286
+ || (preferred.length && !preferred.includes(ending))) return [];
284
287
  const price = option.now != null ? option : listPrices[option.d];
285
- return price?.now != null ? [{ domain, price, value: threeYears(price)?.total ?? Infinity }] : [];
288
+ return [{ domain, price, value: threeYears(price)?.total ?? Infinity, tier: endingTier(domain, preferred, eligible) }];
286
289
  });
290
+ const tier = Math.min(...free.map(option => option.tier));
291
+ const options = free.filter(option => option.tier === tier && option.price?.now != null);
287
292
  if (!options.length) return [];
288
293
  const cheapest = options.reduce((best, row) => row.price.now < best.price.now ? row : best);
289
294
  const value = options.reduce((best, row) => row.value < best.value
@@ -291,7 +296,7 @@ function choiceLines(row, listPrices, eligible) {
291
296
  return ['Cheapest now: ' + shown(cheapest.domain), ...(value.value < Infinity ? [bestValueLine(value.domain, value.price)] : [])];
292
297
  }
293
298
 
294
- export function checkDisplay(result, level = 0, purchase = false) {
299
+ export function checkDisplay(result, level = 0, purchase = false, preferred = []) {
295
300
  const rows = (result.names ?? []).filter(Boolean);
296
301
  if (rows.length === 1 && rows[0].name?.includes('.')) return exactDisplay(result);
297
302
  const listPrices = result.listPrices ?? {};
@@ -342,7 +347,7 @@ export function checkDisplay(result, level = 0, purchase = false) {
342
347
  }
343
348
  for (const [reason, endings] of reasons) lines.push(endings.join(', ') + ' — ' + md(reason) + '.');
344
349
  if (result.complete === false) lines.push('Some checks did not finish in time; check those at a shop.');
345
- if (rows.length === 1) lines.push(...choiceLines(rows[0], listPrices, eligible));
350
+ if (rows.length === 1) lines.push(...choiceLines(rows[0], listPrices, eligible, preferred));
346
351
  const best = result.best;
347
352
  const link = best && safeLink(best.buyUrl, best.domain);
348
353
  if (link) {
@@ -355,12 +360,15 @@ export function checkDisplay(result, level = 0, purchase = false) {
355
360
  } else if (rows.length === 1 || purchase) {
356
361
  const available = rows.flatMap(row => (row.free ?? []).flatMap(option => {
357
362
  const domain = option.d.includes('.') ? option.d : row.name.includes('.') ? row.name : row.name + '.' + option.d;
358
- if (!canRecommend(suffix(domain), eligible)) return [];
363
+ const ending = suffix(domain);
364
+ if (!canRecommend(ending, eligible) || (preferred.length && !preferred.includes(ending))) return [];
359
365
  const price = option.prem || option.s === 'prem' ? option : { ...listPrices[option.d], ...option };
360
366
  const link = templateLink(result.buyUrlTemplate, price.shop, domain);
361
- return link ? [{ link, price: price.now ?? Infinity }] : [];
367
+ // An exact domain the person typed is requested, so it is never demoted to the fallback tier.
368
+ const tier = endingTier(domain, row.name.includes('.') ? [...preferred, domain] : preferred, eligible);
369
+ return link ? [{ link, price: price.now ?? Infinity, tier }] : [];
362
370
  }));
363
- const cheapest = available.sort((a, b) => a.price - b.price)[0];
371
+ const cheapest = available.sort((a, b) => a.tier - b.tier || a.price - b.price)[0];
364
372
  if (cheapest) lines.push('Check at shop: ' + cheapest.link);
365
373
  }
366
374
  return lines.join('\n').trim();
@@ -385,35 +393,48 @@ export function checkLines(row, short = false) {
385
393
 
386
394
  const verdictRank = { 'No conflict found': 0, 'Check first': 1, Avoid: 2 };
387
395
 
388
- // The cheapest free ending this buyer can register, at the name's own price or the standard list price.
389
- function cheapestEligible(row, prices, eligible) {
396
+ // The cheapest free ending this buyer can register, at the name's own price or the standard list price, within the
397
+ // most attractive tier that has a free eligible ending. tier is not part of the pick it returns.
398
+ function cheapestEligible(row, prices, eligible, preferred = []) {
399
+ const free = (Array.isArray(row?.free) ? row.free : []).filter(ending => canRecommend(ending, eligible)
400
+ && (!preferred.length || preferred.includes(ending)));
401
+ const tier = ending => endingTier('.' + ending, preferred, eligible);
402
+ const top = Math.min(...free.map(tier));
390
403
  let best = null;
391
- for (const ending of Array.isArray(row?.free) ? row.free : []) {
404
+ for (const ending of free) {
392
405
  const quote = row.own?.[ending] ?? prices?.[ending];
393
- if (!canRecommend(ending, eligible) || quote?.now == null) continue;
406
+ if (tier(ending) !== top || quote?.now == null) continue;
394
407
  if (!best || quote.now < best.now) best = { ending, now: quote.now, renew: quote.renew ?? null, term: quote.term ?? null };
395
408
  }
396
- return best;
409
+ return best && { ...best, tier: top };
397
410
  }
398
411
 
399
412
  // Three ranked picks once three or more names are screened: the screen's own ranking first, then the other
400
413
  // names by verdict and cheapest eligible price. Each pick carries its cheapest eligible domain and price.
401
- export function topPicks(result) {
414
+ export function topPicks(result, preferred = []) {
402
415
  const rows = (result.names ?? []).filter(Boolean);
403
416
  const prices = result.prices ?? {};
417
+ const eligibleCheapest = row => {
418
+ const found = cheapestEligible(row, prices, result.eligible, preferred);
419
+ if (!found) return null;
420
+ const { tier, ...pick } = found;
421
+ return pick;
422
+ };
404
423
  const picks = (Array.isArray(result.top) ? result.top : []).filter(Boolean).slice(0, 3).map(pick => {
405
424
  if (pick.ending || pick.domain) return pick;
406
- const cheapest = cheapestEligible(rows.find(row => row.name === pick.name), prices, result.eligible);
425
+ const cheapest = eligibleCheapest(rows.find(row => row.name === pick.name));
407
426
  return cheapest ? { ...pick, ...cheapest } : pick;
408
427
  });
409
428
  if (rows.length < 3) return picks;
410
- const rest = rows.map((row, index) => ({ row, index, cheapest: cheapestEligible(row, prices, result.eligible) }))
429
+ const rest = rows.map((row, index) => ({ row, index, cheapest: cheapestEligible(row, prices, result.eligible, preferred) }))
411
430
  .filter(({ row }) => !picks.some(pick => pick.name === row.name))
412
431
  .sort((a, b) => (verdictRank[a.row.verdict] ?? 3) - (verdictRank[b.row.verdict] ?? 3)
432
+ || (a.cheapest?.tier ?? Infinity) - (b.cheapest?.tier ?? Infinity)
413
433
  || (a.cheapest?.now ?? Infinity) - (b.cheapest?.now ?? Infinity) || a.index - b.index);
414
434
  for (const { row, cheapest } of rest.slice(0, 3 - picks.length)) {
435
+ const { tier, ...pick } = cheapest ?? {};
415
436
  picks.push({ name: row.name, verdict: row.verdict, reason: row.reason,
416
- ...(cheapest && { ...cheapest, domain: fullDomain(label(row.name), cheapest.ending) }) });
437
+ ...(cheapest && { ...pick, domain: fullDomain(label(row.name), cheapest.ending) }) });
417
438
  }
418
439
  return picks;
419
440
  }
@@ -424,8 +445,8 @@ function nameLabel(name) {
424
445
  return md(name) + (dns.startsWith('xn--') ? ' (' + md(dns) + ')' : '');
425
446
  }
426
447
 
427
- function topLines(result, showReason, showValue = true) {
428
- return ['**Top picks**', ...topPicks(result).map(row => {
448
+ function topLines(result, showReason, showValue = true, preferred = []) {
449
+ return ['**Top picks**', ...topPicks(result, preferred).map(row => {
429
450
  const ending = row.domain ? shown(row.domain) : row.ending && '.' + row.ending;
430
451
  const domain = ending ? ', cheapest now ' + priced(ending, row) : ', no eligible free ending';
431
452
  const value = !showValue ? '' : typeof row.bestValue === 'string'
@@ -458,7 +479,9 @@ export function triageDisplay(result, prior, { short = false, compact = false, p
458
479
  const rows = (result.names ?? []).filter(Boolean);
459
480
  const earlierRows = new Map((prior?.names ?? []).map(row => [row.name, row.free ?? []]));
460
481
  const lines = [];
461
- if (topPicks(result).length) lines.push(...topLines(result, !prior && rows.length !== 5, !prior && rows.length !== 5), '');
482
+ if (topPicks(result, preferred).length) {
483
+ lines.push(...topLines(result, !prior && rows.length !== 5, !prior && rows.length !== 5, preferred), '');
484
+ }
462
485
  lines.push(prior ? '**Name screen** (USD ex. VAT, estimates)' :
463
486
  '**Name screen** (USD ex. VAT; list prices, the shop shows the final price; 2y = each payment covers two years)');
464
487
  if (result.eligibility) lines.push(eligibilityLine(result));
@@ -612,7 +635,7 @@ export function checkText(result, shortlist = false, { purchase = false, preferr
612
635
  ...(row.shop_check && { shop_check: preferredFirst(row.shop_check, preferred) }),
613
636
  })) };
614
637
  const initialLevel = (result.names?.length ?? 0) >= 10 ? 3 : 0;
615
- const shown = checkDisplay(result, initialLevel, purchase);
638
+ const shown = checkDisplay(result, initialLevel, purchase, preferred);
616
639
  const [row] = result.names ?? [];
617
640
  const exact = result.names?.length === 1 && row?.name?.includes('.');
618
641
  // A registered exact domain already shows the limitation with its status and has no checkout link.
@@ -660,7 +683,7 @@ export function checkText(result, shortlist = false, { purchase = false, preferr
660
683
  const compactDisplay = next => () => {
661
684
  if (next <= level) return;
662
685
  level = next;
663
- display = attributed(checkDisplay(result, level, purchase), ending);
686
+ display = attributed(checkDisplay(result, level, purchase, preferred), ending);
664
687
  };
665
688
  const steps = [
666
689
  // Drop inline prices from unconfirmed rows; the display and the shared list price keep them.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domain-hound",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Find a startup name and domain you can actually buy: availability, prices, app names, trademarks. MCP for Claude Code and Codex.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "domain-hound",
4
- "version": "0.1.6",
4
+ "version": "0.1.7",
5
5
  "description": "Check domain availability and prices, and screen product names, from your AI assistant.",
6
6
  "author": {
7
7
  "name": "Lars Hvinden"
package/results.mjs CHANGED
@@ -4,7 +4,7 @@ import { mkdir, readdir, rename, stat, unlink, writeFile } from 'node:fs/promise
4
4
  import { homedir, userInfo } from 'node:os';
5
5
  import { basename, dirname, join, resolve } from 'node:path';
6
6
  import { fileURLToPath, pathToFileURL } from 'node:url';
7
- import { canRecommend, defaultEndings, domainEnding, eligibilityNeed, normalizeName } from './clis/domain-check/name-search.mjs';
7
+ import { canRecommend, defaultEndings, domainEnding, eligibilityNeed, endingTier, normalizeName } from './clis/domain-check/name-search.mjs';
8
8
  import { handlePriorities, handleStates, handleSummary } from './clis/domain-check/handles.mjs';
9
9
  import { shopSearchUrl, shops } from './clis/domain-check/prices.mjs';
10
10
  import { trademarkSearches } from './clis/domain-check/triage-sources.mjs';
@@ -55,11 +55,13 @@ const markLabel = entry => plain(entry.office) + ' mark: ' + plain(entry.tier) +
55
55
  const watchLink = domain => 'https://domainhound.dev/watch/?domain=' + encodeURIComponent(domain);
56
56
  const verdictOrder = { 'No conflict found': 0, 'Check first': 1, Avoid: 2 };
57
57
 
58
- function resultGroups(data, eligibleEndings) {
58
+ function resultGroups(data, eligibleEndings, preferred = []) {
59
59
  return data.names.map((row, index) => {
60
60
  const detail = data.receiptDetails?.[index] ?? {};
61
61
  const exact = row.name.includes('.');
62
62
  const label = exact ? row.name : normalizeName(row.name);
63
+ const requested = exact ? [...preferred, row.name] : preferred;
64
+ const eligibleList = eligibleEndings ?? data.eligible;
63
65
  const listed = [...(row.free ?? []), ...(row.taken ?? []), ...(row.shop_check ?? []), ...(row.resale ?? []),
64
66
  ...(row.premium ?? []), ...(row.reserved ?? [])].map(value => value.d ?? value).filter(value => typeof value === 'string');
65
67
  const variants = listed.filter(value => value.includes('.') && value !== 'co.uk');
@@ -94,16 +96,19 @@ function resultGroups(data, eligibleEndings) {
94
96
  const source = ({ web: 'Live site', dns: 'DNS', rdap: 'Registry RDAP', whois: 'Registry WHOIS',
95
97
  shop: 'Shop', list: 'Price list' })[raw?.source] ?? (confirmed ? 'Shop' : likely ? 'DNS' : 'Registry');
96
98
  const shop = usd.shop ?? raw?.shop ?? shops[fallbackShop(ending)]?.name;
97
- const eligible = canRecommend(ending, eligibleEndings ?? data.eligible);
99
+ const eligible = canRecommend(ending, eligibleList);
98
100
  const shopUrl = shopSearchUrl(shopIds.get(shop) ?? fallbackShop(ending), domain);
99
101
  const checkout = taken || reserved || !eligible ? null : [raw?.checkout, shopUrl].find(url => safeLink(url, domain)) ?? null;
100
- return { domain, ending, state, status, ...usd, total, shop, checkout, eligible, source, ...(raw?.savings && { savings: raw.savings }),
102
+ return { domain, ending, tier: endingTier(domain, requested, eligibleList), state, status, ...usd, total,
103
+ shop, checkout, eligible, source, ...(raw?.savings && { savings: raw.savings }),
101
104
  priceLabel: usd.now != null || usd.renew != null ? (confirmed ? 'Shop quote' : taken ? 'Standard list price benchmark' : 'List price') : '',
102
105
  checkedAt: raw?.checkedAt ?? data.checkedAt, priceAt: confirmed ? raw?.checkedAt ?? data.checkedAt : raw?.priceAt ?? data.priceListDate,
103
106
  site: raw?.site ?? detail.details?.sites?.[ending] ?? row.details?.sites?.[ending] };
104
107
  });
108
+ // Free rows first, then by attractiveness tier (a typed exact domain is requested), then by upfront payment.
105
109
  records.sort((a, b) => Number(b.state === 'free' || b.priceLabel === 'Shop quote')
106
- - Number(a.state === 'free' || a.priceLabel === 'Shop quote') || (a.now ?? Infinity) - (b.now ?? Infinity));
110
+ - Number(a.state === 'free' || a.priceLabel === 'Shop quote')
111
+ || a.tier - b.tier || (a.now ?? Infinity) - (b.now ?? Infinity));
107
112
  return { row: { ...row, ...detail, name: row.name }, records };
108
113
  });
109
114
  }
@@ -142,8 +147,13 @@ function signals(group, triage = true) {
142
147
  return 'iOS: ' + appFinding(comp.AppStore, row, 'App Store') + ' | Android: ' + appFinding(comp.GooglePlay, row, 'Google Play') + ' | web: ' + web;
143
148
  }
144
149
 
150
+ const cents = value => Math.round(value * 100);
151
+ // A fallback ending is worth its own line only when it saves more than $10 over 3 years against the best value.
152
+ const fallbackSavingsCents = 1000;
153
+
145
154
  // One selection feeds the receipt lines and the share link: preferred endings, budget, eligibility, verdict and
146
155
  // confirmed quotes decide the candidates; best value compares payments due in 3 years (y3 quote or term-aware sum).
156
+ // Pick, cheapest and best value stay within the most attractive tier that has an in-scope candidate.
147
157
  // names[i] is the same choice made inside groups[i] alone: its first candidate, its best value and its taken rows,
148
158
  // preferred endings first in the user's order (.com first by default).
149
159
  function receiptSelection(groups, args, triage) {
@@ -159,10 +169,26 @@ function receiptSelection(groups, args, triage) {
159
169
  const cost = item => item.record.now ?? Infinity;
160
170
  const compareCost = (a, b) => cost(a) - cost(b);
161
171
  const position = item => preferred.length ? preferred.indexOf(item.record.ending) : 0;
172
+ const tier = item => item.record.tier;
173
+ const topTier = items => {
174
+ const first = Math.min(...items.map(tier));
175
+ return items.filter(item => tier(item) === first);
176
+ };
162
177
  candidates.sort((a, b) => (verdictOrder[a.group.row.verdict] ?? 0) - (verdictOrder[b.group.row.verdict] ?? 0)
163
- || position(a) - position(b) || compareCost(a, b) || a.record.domain.localeCompare(b.record.domain));
164
- const bestValue = items => items.filter(item => item.record.total != null)
178
+ || position(a) - position(b) || tier(a) - tier(b) || compareCost(a, b) || a.record.domain.localeCompare(b.record.domain));
179
+ const lowestTotal = items => items.filter(item => item.record.total != null)
165
180
  .sort((a, b) => a.record.total - b.record.total || compareCost(a, b))[0];
181
+ // Within the top tier only: when its rows lack a three-year total, best value needs a shop quote.
182
+ const bestValue = items => lowestTotal(topTier(items));
183
+ const top = topTier(candidates);
184
+ const value = lowestTotal(top);
185
+ const picks = [];
186
+ for (const item of top) {
187
+ if (picks.some(pick => pick.group === item.group)) continue;
188
+ picks.push(item);
189
+ if (picks.length === 3) break;
190
+ }
191
+ const fallback = value && tier(value) === 0 ? lowestTotal(candidates.filter(item => tier(item) === 1)) : undefined;
166
192
  const order = preferred.length ? preferred : ['com'];
167
193
  const takenRank = record => {
168
194
  const index = order.indexOf(record.ending);
@@ -170,10 +196,12 @@ function receiptSelection(groups, args, triage) {
170
196
  };
171
197
  return {
172
198
  exact, preferred, budget,
173
- best: candidates[0],
174
- picks: [...new Map(candidates.toReversed().map(item => [item.group, item])).values()].reverse().slice(0, 3),
175
- cheapest: candidates.filter(item => item.record.now != null).sort(compareCost)[0],
176
- value: bestValue(candidates),
199
+ best: picks[0],
200
+ picks,
201
+ cheapest: top.filter(item => item.record.now != null).sort(compareCost)[0],
202
+ value,
203
+ // The cheapest fallback over 3 years, only when it saves more than $10 against the top-tier best value.
204
+ saving: fallback && cents(value.record.total) - cents(fallback.record.total) > fallbackSavingsCents ? fallback : null,
177
205
  names: groups.map(group => {
178
206
  const own = candidates.filter(item => item.group === group);
179
207
  return { pick: own[0]?.record ?? null, value: bestValue(own)?.record ?? null,
@@ -185,7 +213,7 @@ function receiptSelection(groups, args, triage) {
185
213
 
186
214
  function summary(groups, args, triage, selection) {
187
215
  const [wanted] = groups;
188
- const { exact: isExact, preferred, budget, best, picks, cheapest, value } = selection;
216
+ const { exact: isExact, preferred, budget, best, picks, cheapest, value, saving } = selection;
189
217
  const constraints = [...(!isExact && preferred.length ? [preferred.map(ending => '.' + ending).join(', ') + ' first'] : []),
190
218
  ...(budget != null ? ['Up to ' + cash(budget) + ' today'] : [])];
191
219
  const target = wanted.records.find(record => record.ending === (preferred[0] ?? 'com')) ?? wanted.records[0];
@@ -233,9 +261,11 @@ function summary(groups, args, triage, selection) {
233
261
  handles && 'Handles for ' + evidenceText(wanted.row.name) + ': ' + plain(handles) + '.',
234
262
  running.length ? 'Still checking ' + running.join(', ') + '. The results page updates by itself.' : null,
235
263
  ...offerLines,
236
- 'Cheapest: ' + (cheapest ? label(cheapest) : 'none found in scope.'),
264
+ 'Cheapest: ' + (cheapest ? label(cheapest) : best ? 'needs a shop quote.' : 'none found in scope.'),
237
265
  'Best value: ' + (value ? value.record.domain + ', ' + cash(value.record.total) + ' in payments due in 3 years'
238
266
  + ' (' + value.record.priceLabel.toLowerCase() + priceDate(value.record) + ')' + caution(value) : 'needs a shop quote') + '.',
267
+ saving && 'Fallback: ' + saving.record.domain + ', ' + cash(saving.record.total) + ' in 3 years, saves '
268
+ + cash((cents(value.record.total) - cents(saving.record.total)) / 100) + caution(saving) + '.',
239
269
  (args.purchase ? 'This check leaves checkout to you. ' : '') + next + eligibility,
240
270
  ];
241
271
  // Savings are page-only proof for each pick: dated list prices from at least three shops, never a pitch.
@@ -413,7 +443,7 @@ function render(groups, lines, checkedAt, coverage, watch, companyType, { saving
413
443
  const shared = shareUrl(groups, checkedAt, shareFacts);
414
444
  const shareLabel = groups.length > 5 ? 'Share first five names' : 'Share';
415
445
  const [intro, ...body] = lines;
416
- const comparison = body.filter(line => /^(?:Cheapest|Best value):/.test(line));
446
+ const comparison = body.filter(line => /^(?:Cheapest|Best value|Fallback):/.test(line));
417
447
  const before = body.filter(line => !comparison.includes(line)).slice(0, comparison.length ? -1 : undefined);
418
448
  const after = comparison.length ? body.slice(-1) : [];
419
449
  const sources = watch?.source ? 'Registry: ' + String(watch.source).toUpperCase() :
@@ -553,7 +583,7 @@ export function resultPages({ env = process.env,
553
583
  return (data, args, { triage = false, watch = false, reuse = null, refresh = false } = {}) => {
554
584
  const work = writes.then(async () => {
555
585
  const at = data.checkedAt ?? new Date().toISOString();
556
- const groups = watch ? [] : resultGroups(data, args.eligible);
586
+ const groups = watch ? [] : resultGroups(data, args.eligible, args.endings);
557
587
  const selection = receiptSelection(groups, args, triage);
558
588
  const { lines, savings, shortLines } = watch ? { lines: data.say.split('\n'), savings: [] } : data.pending ? { lines: [
559
589
  ...(data.failed ? ['Some checks did not finish. Registry answers received are on the page.']
package/server.json CHANGED
@@ -4,12 +4,12 @@
4
4
  "title": "Domain Hound",
5
5
  "description": "Find a startup name and domain you can buy: availability, prices, app names, trademarks, handles.",
6
6
  "websiteUrl": "https://domainhound.dev",
7
- "version": "0.1.6",
7
+ "version": "0.1.7",
8
8
  "packages": [
9
9
  {
10
10
  "registryType": "npm",
11
11
  "identifier": "domain-hound",
12
- "version": "0.1.6",
12
+ "version": "0.1.7",
13
13
  "transport": {
14
14
  "type": "stdio"
15
15
  }
package/server.mjs CHANGED
@@ -257,6 +257,8 @@ function triageArguments(args) {
257
257
  throw new Error('names[' + bad + '] is not valid. Supply 1 to 20 bare names of up to 100 characters, without commas or domain endings.');
258
258
  }
259
259
  const flags = lookupFlags(args);
260
+ // Requested endings are never demoted to the fallback tier in the screen's own picks.
261
+ if (args.endings) flags.push('--prefer-endings', args.endings.join(','));
260
262
  if (Object.hasOwn(args, 'shortlist') && typeof args.shortlist !== 'boolean') throw new Error('shortlist must be a boolean.');
261
263
  const { companyType, additionalHandles } = args;
262
264
  if (companyType !== undefined && !Object.hasOwn(handlePriorities, companyType)) throw new Error('Choose a supported company type.');