domain-hound 0.1.8 → 0.1.9

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.
package/results.mjs CHANGED
@@ -6,12 +6,14 @@ import { basename, dirname, join, resolve } from 'node:path';
6
6
  import { fileURLToPath, pathToFileURL } from 'node:url';
7
7
  import { canRecommend, choosePick, comparePicks, defaultEndings, domainEnding, eligibilityNeed, lowestTotal, lowestUpfront, normalizeName,
8
8
  qualityRank } from './clis/domain-check/name-search.mjs';
9
- import { handlePriorities, handleStates, handleSummary } from './clis/domain-check/handles.mjs';
9
+ import { handleLabel, handlePriorities, handleSummary, linkedInSearchHint } from './clis/domain-check/handles.mjs';
10
+ import { googlePlayLabel, googlePlayLinkLabel, playSearchLink } from './clis/domain-check/google-play.mjs';
10
11
  import { dnsNeed, shopSearchUrl, shops } from './clis/domain-check/prices.mjs';
11
12
  import { trademarkSearches } from './clis/domain-check/triage-sources.mjs';
12
13
  import { safeLink } from './display.mjs';
13
14
  import { receiptStyle } from './results-style.mjs';
14
15
  import { shareUrl } from './share.mjs';
16
+ import { compareScores, scoreEligible, scoreHeadline, scoreName } from './clis/domain-check/name-score.mjs';
15
17
 
16
18
  const cash = value => Number.isFinite(value) ? '$' + value.toFixed(2) : null;
17
19
  const escape = value => String(value ?? '').replace(/[&<>"']/g, char =>
@@ -27,14 +29,14 @@ const markOf = row => row.competition?.US;
27
29
  const waitingOn = (row, source) => Array.isArray(row.waiting) && row.waiting.includes(source);
28
30
  const notScreened = row => row.competition?.sameName?.summary === 'Not screened';
29
31
  const missing = (row, source) => waitingOn(row, source) ? 'still checking' : notScreened(row) ? 'not screened' : 'check incomplete';
30
- // EU and Norway marks appear once their key is set: a hit, [] for none, null for check yourself.
32
+ // EU and Norway marks appear once their key is set: a hit, [] for none, null for an incomplete check.
31
33
  const offices = [['EU', 'EU', 'EUIPO'], ['NO', 'Norway', 'Patentstyret']];
32
34
  const officeText = (row, office, name) => {
33
35
  const mark = row.competition?.[office];
34
36
  if (typeof mark === 'string') return evidenceText(mark);
35
37
  if (mark === true) return 'match found';
36
38
  if (mark != null) return 'no match found';
37
- return waitingOn(row, name) ? 'still checking' : 'check yourself';
39
+ return waitingOn(row, name) ? 'still checking' : "couldn't check";
38
40
  };
39
41
  const marksText = (row, skip = []) => {
40
42
  const mark = markOf(row);
@@ -55,6 +57,17 @@ const markLabel = entry => plain(entry.office) + ' mark: ' + plain(entry.tier) +
55
57
  + (entry.checkedAt ? ', earlier answer from ' + plain(entry.checkedAt) : '');
56
58
  const watchLink = domain => 'https://domainhound.dev/watch/?domain=' + encodeURIComponent(domain);
57
59
  const verdictOrder = { 'No conflict found': 0, 'Check first': 1, Avoid: 2 };
60
+ // "Name score 91/100 - how clear the road is · Strong", or why a name has none. An exact domain check has no Name score.
61
+ function scoreText(row) {
62
+ const score = row.score;
63
+ if (score?.filtered) return 'Not scored: ' + plain(score.filtered) + '.';
64
+ const headline = scoreHeadline(score);
65
+ if (headline) return headline + ' · ' + plain(score.band) + (score.pending ? ' (still checking)' : '') + '.';
66
+ return row.verdict && notScreened(row) ? 'Name score: not screened (first five names only).' : null;
67
+ }
68
+ const scoreReasons = row => Array.isArray(row.score?.reasons) && !row.score.filtered ? row.score.reasons.map(plain) : [];
69
+ const shortScore = row => Number.isInteger(row.score?.value) ? ' Name score ' + row.score.value + '/100, ' + plain(row.score.band) + '.'
70
+ : row.score?.filtered ? ' Not scored: ' + plain(row.score.filtered) + '.' : '';
58
71
 
59
72
  function resultGroups(data, eligibleEndings, preferred = []) {
60
73
  return data.names.map((row, index) => {
@@ -83,12 +96,12 @@ function resultGroups(data, eligibleEndings, preferred = []) {
83
96
  const risk = Boolean(option?.risk || raw?.risk);
84
97
  const premium = Boolean(match(row.premium) || option?.s === 'prem' || option?.prem || risk);
85
98
  const includePrice = !reserved && (!premium || confirmed) && (!taken || exact);
86
- const likely = match(row.likely_free) ? 'likely free by DNS' : match(row.likely_taken) ? 'likely taken by DNS' : null;
99
+ const likely = match(row.likely_free) ? 'possibly available by DNS' : match(row.likely_taken) ? 'likely taken by DNS' : null;
87
100
  const state = taken ? 'taken' : premium ? 'premium' : option ? 'free' : 'check';
88
101
  const status = taken ? (match(row.resale) ? 'Taken, possible resale' : 'Taken')
89
102
  : reserved ? 'Not offered for registration' : confirmed ? 'Confirmed at shop'
90
103
  : premium ? (risk ? 'May be premium, price at shop' : 'Premium, price at shop')
91
- : option ? 'Free at the registry' : likely ? 'Check at shop, ' + likely
104
+ : option ? 'Available at the registry' : likely ? 'Check at shop, ' + likely
92
105
  : data.pending && !data.failed && !match(row.shop_check) ? 'Still checking' : 'Check at shop';
93
106
  const usd = includePrice ? { now: quote.now, renew: quote.renew, y3: quote.y3, term: quote.term,
94
107
  jump: quote.jump, shop: quote.shop } : {};
@@ -115,6 +128,17 @@ function resultGroups(data, eligibleEndings, preferred = []) {
115
128
  });
116
129
  }
117
130
 
131
+ function availabilityScore(group, args) {
132
+ const { row, records } = group;
133
+ if (row.name.includes('.')) return group;
134
+ const label = normalizeName(row.name);
135
+ const domains = records.filter(record => record.status === 'Available at the registry' && record.eligible
136
+ && record.domain === label + '.' + record.ending && (!args.endings?.length || args.endings.includes(record.ending))
137
+ && (args.budget == null || (record.now ?? Infinity) <= args.budget))
138
+ .map(record => ({ ending: record.ending, total: record.total, registry: true }));
139
+ return { ...group, row: { ...row, score: scoreName({ name: row.name, domains }) } };
140
+ }
141
+
118
142
  function priceDate(offer) {
119
143
  return offer.priceAt ? ' checked ' + offer.priceAt.slice(0, 10) : '';
120
144
  }
@@ -146,7 +170,9 @@ function signals(group, triage = true) {
146
170
  : waitingOn(row, 'websites') ? 'still checking' : states.includes('unknown') ? 'check incomplete'
147
171
  : checked ? 'no live site found on checked endings' : 'not checked';
148
172
  if (!triage) return 'web: ' + web;
149
- return 'iOS: ' + appFinding(comp.AppStore, row, 'App Store') + ' | Android: ' + appFinding(comp.GooglePlay, row, 'Google Play') + ' | web: ' + web;
173
+ const android = comp.GooglePlay != null || waitingOn(row, 'Google Play')
174
+ ? ' | Android: ' + appFinding(comp.GooglePlay, row, 'Google Play') : '';
175
+ return 'iOS: ' + appFinding(comp.AppStore, row, 'App Store') + android + ' | web: ' + web;
150
176
  }
151
177
 
152
178
  // One selection feeds the receipt lines and the share link: preferred endings, budget, eligibility, verdict and
@@ -163,7 +189,8 @@ function receiptSelection(groups, args, triage, eligible = []) {
163
189
  const inScope = record => record.eligible && (!preferred.length || preferred.includes(record.ending))
164
190
  && (budget == null || (record.now ?? Infinity) <= budget);
165
191
  // An exact lookup reports its one domain and never recommends.
166
- const candidates = exact ? [] : groups.flatMap(group => group.row.verdict === 'Avoid' ? [] : group.records
192
+ // Triage recommendations require a name that passed its filters. Availability-only checks still show domain offers.
193
+ const candidates = exact ? [] : groups.flatMap(group => triage && !scoreEligible(group.row) ? [] : group.records
167
194
  .filter(record => inScope(record) && (record.state === 'free' || record.priceLabel === 'Shop quote'))
168
195
  .map(record => ({ group, record, domain: record.domain, now: record.now ?? null, total: record.total ?? null })));
169
196
  const context = group => ({ requested: group.row.name.includes('.') ? [...preferred, group.row.name] : preferred,
@@ -177,8 +204,9 @@ function receiptSelection(groups, args, triage, eligible = []) {
177
204
  const picks = groups.flatMap(group => {
178
205
  const pick = pickOf(group);
179
206
  return pick ? [pick] : [];
180
- }).sort((a, b) => (verdictOrder[a.group.row.verdict] ?? 0) - (verdictOrder[b.group.row.verdict] ?? 0)
181
- || comparePicks(a, b, across) || a.record.domain.localeCompare(b.record.domain)).slice(0, 3);
207
+ }).sort((a, b) => (triage ? compareScores(a.group.row.score, b.group.row.score) : 0)
208
+ || (verdictOrder[a.group.row.verdict] ?? 0) - (verdictOrder[b.group.row.verdict] ?? 0)
209
+ || comparePicks(a, b, across) || a.record.domain.localeCompare(b.record.domain)).slice(0, triage && args.shortlist ? 8 : 3);
182
210
  const order = preferred.length ? preferred : ['com'];
183
211
  const takenRank = record => {
184
212
  const index = order.indexOf(record.ending);
@@ -223,8 +251,8 @@ function summary(groups, args, triage, selection) {
223
251
  const reason = evidenceText(wanted.row.reason).replace('David vs Goliath: ', 'Established rival: ');
224
252
  const keep = triage ? 'Keep ' + evidenceText(wanted.row.name) + '? ' + plain(wanted.row.verdict) + '. '
225
253
  + reason.replaceAll(' · ', '. ') + '.'
226
- + markScreen(wanted.row, reason)
227
- + (wanted.row.verdict === 'Avoid' && best ? (best.group.row.verdict === 'No conflict found' ? ' Best free rename: ' : ' Next name to check: ')
254
+ + markScreen(wanted.row, reason) + shortScore(wanted.row)
255
+ + (wanted.row.verdict === 'Avoid' && best ? (best.group.row.verdict === 'No conflict found' ? ' Best available alternative: ' : ' Next name to check: ')
228
256
  + plain(best.group.row.name) + '.' : '')
229
257
  + (picks.some(item => item.group === wanted) ? '' : ' | ' + signals(wanted, triage)) : null;
230
258
  const next = watch ?? (!triage && args.shortlist ? 'Next: screen the best names.' : best ? 'Next: check your pick at the shop.' : 'Next: try another name.');
@@ -232,7 +260,9 @@ function summary(groups, args, triage, selection) {
232
260
  const label = item => offerText(item.record, true) + caution(item);
233
261
  const offerLines = picks.map(({ group, record }, index) =>
234
262
  (budget != null && index === 0 ? 'Pick: ' : (index + 1) + '. ') + offerText(record) + ' (' + plain(record.status.toLowerCase()) + ') | '
235
- + (triage ? plain(group.row.verdict) + ' | ' + marksText(group.row) + ' | ' : '') + signals(group, triage));
263
+ + (triage ? plain(group.row.verdict) + ' |' + (shortScore(group.row) ? shortScore(group.row).slice(0, -1) + ' |' : '')
264
+ + (scoreReasons(group.row).length ? ' ' + scoreReasons(group.row).join('; ') + ' |' : '') + ' ' + marksText(group.row) + ' | ' : '')
265
+ + signals(group, triage));
236
266
  const scope = constraints.length ? constraints.join(' | ') + '. ' : '';
237
267
  const leadPick = scope && offerLines.length ? scope + offerLines.shift() : null;
238
268
  const eligibility = args.eligible?.includes('no') || cheapest?.record.ending === 'no'
@@ -246,7 +276,10 @@ function summary(groups, args, triage, selection) {
246
276
  const lines = [
247
277
  leadPick || (scope ? scope + 'All endings are on the page.' : null),
248
278
  keep,
279
+ !triage && shortScore(wanted.row) ? shortScore(wanted.row).trim() : null,
249
280
  handles && 'Handles for ' + evidenceText(wanted.row.name) + ': ' + plain(handles) + '.',
281
+ triage && wanted.row.competition?.GooglePlay == null && !waitingOn(wanted.row, 'Google Play')
282
+ ? googlePlayLabel + ' · [' + googlePlayLinkLabel + '](' + playSearchLink(wanted.row.name) + ')' : null,
250
283
  running.length ? 'Still checking ' + running.join(', ') + '. The results page updates by itself.' : null,
251
284
  ...offerLines,
252
285
  // Cheapest upfront and best value over 3 years each get a line only when they are not the pick.
@@ -260,7 +293,8 @@ function summary(groups, args, triage, selection) {
260
293
  const savings = picks.map(({ record }) => savingsLine(record)).filter(Boolean);
261
294
  const shortLines = args.shortlist && triage ? [
262
295
  constraints.length ? constraints.join(' | ') + '.' : null,
263
- ...picks.map(({ group, record }) => offerText(record) + '. ' + plain(group.row.verdict) + '.'),
296
+ ...picks.map(({ group, record }) => offerText(record) + '. ' + plain(group.row.verdict) + '.' + shortScore(group.row)
297
+ + (scoreReasons(group.row).length ? ' ' + scoreReasons(group.row).join('. ') + '.' : '')),
264
298
  picks.length ? null : 'No available pick in scope.',
265
299
  running.length ? 'Still checking ' + running.join(', ') + '. The results page updates.' : null,
266
300
  args.purchase ? 'Domain Hound cannot buy or complete checkout.' : null,
@@ -294,7 +328,7 @@ function markScreen(row, reason) {
294
328
  const link = hit && recordLink(hit.url);
295
329
  return (named.length ? ' ' + named.map(office => office === 'NO' ? 'Norway' : office).join(' and ') + ' trademark screen.' : '')
296
330
  + (rest ? ' ' + rest + '.' : '') + (link ? ' [' + plain(hit.office) + ' record](' + link + ').' : '')
297
- + manual.map(([, label, name]) => ' [' + name + '](' + trademarkSearches[label] + '): check yourself.').join('');
331
+ + manual.map(([, label, name]) => ' [' + name + '](' + trademarkSearches[label] + "): couldn't check.").join('');
298
332
  }
299
333
 
300
334
  function httpsLink(value) {
@@ -317,16 +351,16 @@ function details(group) {
317
351
  const matches = [
318
352
  ['US marks: ' + (typeof markOf(row) === 'string' ? plain(markOf(row)) : markOf(row) == null ? missing(row, 'USPTO') : 'no match found'), httpsLink(comp.mark)],
319
353
  ...officeMarks(row).map(entry => [markLabel(entry), recordLink(entry.url)]),
320
- // An office without a key, or one that did not answer in full, reads check yourself with its search.
354
+ // An office without a key, or one that did not answer in full, links to its search.
321
355
  ...offices.filter(([office]) => typeof comp[office] !== 'string').map(([office, label, name]) => [
322
- label + ' marks: ' + (!Object.hasOwn(comp, office) ? 'not checked automatically, check yourself'
356
+ label + ' marks: ' + (!Object.hasOwn(comp, office) ? "couldn't check"
323
357
  : waitingOn(row, name) ? 'still checking'
324
- : comp[office] == null ? 'check yourself, ' + name + ' did not answer in full' : 'no match found'),
358
+ : comp[office] == null ? "couldn't check, " + name + ' did not answer in full' : 'no match found'),
325
359
  Array.isArray(comp[office]) ? null : trademarkSearches[label]]),
326
- ['WIPO marks: check yourself', trademarkSearches.WIPO],
360
+ ['WIPO marks', trademarkSearches.WIPO, 'Search WIPO'],
327
361
  ...(row.meaning ? [['Meaning: ' + plain(row.meaning)]] : []),
328
362
  ...(comp.AppStore == null ? [['iOS: ' + missing(row, 'App Store')]] : []),
329
- ...(comp.GooglePlay == null ? [['Android: ' + missing(row, 'Google Play')]] : []),
363
+ ...(waitingOn(row, 'Google Play') ? [['Android: still checking']] : []),
330
364
  ...ios.map(value => ['iOS: ' + titleAndLink(value)[0], titleAndLink(value)[1]]),
331
365
  ...android.map(value => ['Android: ' + titleAndLink(value)[0], titleAndLink(value)[1]]),
332
366
  ...[...(comp.sameName?.Norway ?? []), ...(comp.sameName?.EDGAR ?? [])].map(company => [plain(
@@ -338,23 +372,22 @@ function details(group) {
338
372
  ['Web search: ' + plain(row.google?.why === 'still checking' ? 'still checking' : row.google?.result ?? 'check incomplete'), httpsLink(row.google?.link)],
339
373
  ...(waitingOn(row, 'websites') ? [['Websites on taken endings: still checking']] : []),
340
374
  ['iOS search', 'https://apps.apple.com/us/iphone/search?term=' + encodeURIComponent(row.name)],
341
- ['Android search', 'https://play.google.com/store/search?q=' + encodeURIComponent(row.name) + '&c=apps'],
375
+ [comp.GooglePlay == null ? googlePlayLabel : '', playSearchLink(row.name), googlePlayLinkLabel],
342
376
  ...(row.traction ? [[plain(row.traction.rival ?? row.traction.name ?? ''),
343
377
  httpsLink(row.traction.domain && 'https://' + row.traction.domain)],
344
378
  ...Object.values(row.traction).flat().filter(value => typeof value === 'string').map(value => [plain(value)])] : []),
345
379
  ...(typeof row.reason === 'string' ? row.reason.split(' · ').slice(1).map(value => [plain(value)]) : []),
346
380
  ];
347
- return matches.filter(([text, href]) => text && (href || !/ search$/.test(text)));
381
+ return matches.filter(([text, href, linkLabel]) => linkLabel || text && (href || !/ search$/.test(text)));
348
382
  }
349
383
 
350
- // One line per platform in display order: Taken, No public profile found or Check yourself, with the profile link.
351
384
  function handleLines(group) {
352
385
  const rows = Array.isArray(group.row.handles) ? group.row.handles : [];
353
386
  return rows.flatMap(row => {
354
- const label = row.platform + ' @' + plain(row.handle) + ': ' + (handleStates[row.state] ?? handleStates.check);
387
+ const label = row.platform + ' @' + plain(row.handle) + ' · ' + handleLabel(row);
355
388
  const detail = row.why === 'still checking' ? ' · still checking' : row.checkedAt ? ' · checked ' + plain(row.checkedAt) : '';
356
- return [[label + detail, httpsLink(row.link)], ...(row.variants ?? []).map(variant => [
357
- row.platform + ' alternative @' + plain(variant.handle) + ': ' + (handleStates[variant.state] ?? handleStates.check),
389
+ return [[label + detail, httpsLink(row.link), row.linkLabel], ...(row.variants ?? []).map(variant => [
390
+ row.platform + ' alternative @' + plain(variant.handle) + ' · ' + handleLabel(variant),
358
391
  httpsLink(variant.link),
359
392
  ])];
360
393
  });
@@ -371,13 +404,15 @@ function trademarkSnapshot(row) {
371
404
  }
372
405
 
373
406
  function nameSnapshot({ row, records }) {
374
- const apps = [row.competition?.AppStore, row.competition?.GooglePlay];
407
+ const apps = [row.competition?.AppStore, ...(row.competition?.GooglePlay != null || waitingOn(row, 'Google Play')
408
+ ? [row.competition?.GooglePlay] : [])];
375
409
  const open = records.filter(record => record.state === 'free' && record.eligible).length;
376
410
  const blocked = records.filter(record => record.state === 'taken').length;
377
411
  const handles = Array.isArray(row.handles) ? row.handles : [];
378
412
  const taken = handles.filter(handle => handle.state === 'taken').length;
379
413
  const absent = handles.filter(handle => handle.state === 'not-found').length;
380
- const checks = handles.filter(handle => handle.state === 'check').length;
414
+ const notSeen = handles.filter(handle => handle.state === 'not-seen').length;
415
+ const checks = handles.length - taken - absent - notSeen;
381
416
  return [
382
417
  'Domains ' + open + ' open' + (blocked ? ', ' + blocked + ' taken' : ''),
383
418
  'Trademark ' + trademarkSnapshot(row),
@@ -385,7 +420,8 @@ function nameSnapshot({ row, records }) {
385
420
  'Apps ' + (apps.some(value => value?.length) ? 'same-name listing' : apps.some(value => value == null)
386
421
  ? (waitingOn(row, 'App Store') || waitingOn(row, 'Google Play') ? 'still checking' : notScreened(row) ? 'not screened' : 'check incomplete') : 'no match'),
387
422
  'Handles ' + (handles.length ? [taken ? taken + ' taken' : null,
388
- absent + taken ? absent + ' of ' + (absent + taken) + ' with no public match' : null, checks ? checks + ' to check' : null].filter(Boolean).join(', ')
423
+ absent ? absent + ' with no profile found' : null, notSeen ? notSeen + ' with no page found in public archives' : null,
424
+ checks ? "couldn't check " + checks : null].filter(Boolean).join(', ')
389
425
  : 'outside top three'),
390
426
  ].join(' / ');
391
427
  }
@@ -394,11 +430,20 @@ function handlePriority({ row }, companyType) {
394
430
  if (!Array.isArray(row.handles) || !row.handles.length || !Object.hasOwn(handlePriorities, companyType)) return '';
395
431
  return 'Handles to secure for this business: ' + handlePriorities[companyType].map(platform => {
396
432
  const entry = row.handles.find(handle => handle.platform === platform);
397
- return platform + ' ' + (entry?.why === 'still checking' ? 'still checking' : handleStates[entry?.state ?? 'check'].toLowerCase());
433
+ return platform + ' · ' + (entry?.why === 'still checking' ? 'still checking' : handleLabel(entry));
398
434
  }).join(', ') + '.';
399
435
  }
400
436
 
401
437
  const anchor = (label, url) => '<a href="' + escape(url) + '">' + escape(label) + '</a>';
438
+ function evidenceHtml([label, url, linkLabel]) {
439
+ if (!url) return escape(label);
440
+ return (linkLabel && label ? escape(label) + ' · ' : '') + anchor(linkLabel ?? label, url);
441
+ }
442
+
443
+ function evidenceMarkdown([label, url, linkLabel]) {
444
+ if (!url) return markdown(label);
445
+ return (linkLabel && label ? markdown(label) + ' · ' : '') + '[' + markdown(linkLabel ?? label) + '](' + url + ')';
446
+ }
402
447
  function summaryHtml(line) {
403
448
  return Array.from(line.matchAll(/\[([^\]]+)\]\((https:\/\/[^\s)]+)\)/g)).reduce(({ html, offset }, match) =>
404
449
  ({ html: html + escape(line.slice(offset, match.index)) + anchor(match[1], match[2]), offset: match.index + match[0].length }),
@@ -426,9 +471,9 @@ export function disclosure(data, triage) {
426
471
  + 'Up to three go to public handle APIs. Domain Hound uses your brief locally. ' + shop;
427
472
  }
428
473
 
429
- function render(groups, lines, checkedAt, coverage, watch, companyType, { savings = [], note = '', refresh = false, shareFacts = [] } = {}) {
474
+ function render(groups, lines, checkedAt, coverage, watch, companyType, { savings = [], note = '', refresh = false, shareFacts = [], hostedShare } = {}) {
430
475
  const title = watch ? 'Domain watch' : 'Domain results';
431
- const shared = shareUrl(groups, checkedAt, shareFacts);
476
+ const shared = hostedShare ?? shareUrl(groups, checkedAt, shareFacts);
432
477
  const shareLabel = groups.length > 5 ? 'Share first five names' : 'Share';
433
478
  const [intro, ...body] = lines;
434
479
  const comparison = body.filter(line => /^(?:Cheapest|Best value):/.test(line));
@@ -448,12 +493,14 @@ function render(groups, lines, checkedAt, coverage, watch, companyType, { saving
448
493
  });
449
494
  return '<article id="name-' + index + '"><h2>' + escape(row.name) + '</h2>'
450
495
  + (row.verdict ? paragraph(plain(row.verdict) + '. ' + evidenceText(row.reason).split(' · ')[0]) + paragraph(nameSnapshot(group)) : '')
496
+ + (scoreText(row) ? '<div class="name-score">' + paragraph(scoreText(row))
497
+ + (scoreReasons(row).length ? '<ul>' + scoreReasons(row).map(line => '<li>' + escape(line) + '</li>').join('') + '</ul>' : '') + '</div>' : '')
451
498
  + '<table><caption>Endings · USD before tax</caption><thead><tr><th scope="col">Ending</th><th scope="col">Today</th><th scope="col">Renewal</th></tr></thead><tbody>'
452
499
  + rows.join('') + '</tbody></table>'
453
500
  + (row.verdict ? '<details><summary>Trademark, app and web evidence</summary><ul>'
454
- + details(group).map(([label, url]) => '<li>' + (url ? anchor(label, url) : escape(label)) + '</li>').join('') + '</ul></details>' : '')
501
+ + details(group).map(line => '<li>' + evidenceHtml(line) + '</li>').join('') + '</ul></details>' : '')
455
502
  + (handles.length ? '<details><summary>Handles</summary>' + (priority ? paragraph(priority) : '') + '<ul>'
456
- + handles.map(([label, url]) => '<li>' + (url ? anchor(label, url) : escape(label)) + '</li>').join('') + '</ul></details>'
503
+ + handles.map(line => '<li>' + evidenceHtml(line) + '</li>').join('') + '</ul></details>'
457
504
  : row.verdict ? '<p><small>Handles: checked for the top three names.</small></p>' : '')
458
505
  + '</article>';
459
506
  });
@@ -473,12 +520,13 @@ function render(groups, lines, checkedAt, coverage, watch, companyType, { saving
473
520
  const md = ['# ' + title, '', 'Domain Hound · ' + checkedAt, '', ...lines, ...(savings.length ? ['', ...savings] : []), '',
474
521
  ...groups.flatMap(group => ['## ' + markdown(group.row.name), '',
475
522
  ...(group.row.verdict ? [markdown(group.row.verdict + '. ' + group.row.reason), markdown(nameSnapshot(group)), ''] : []),
523
+ ...(scoreText(group.row) ? [markdown(scoreText(group.row)), ...scoreReasons(group.row).map(line => '- ' + markdown(line)), ''] : []),
476
524
  '| Ending | Today (USD) | Renewal (USD) | Evidence | Shop |', '| --- | --- | --- | --- | --- |',
477
525
  ...group.records.map(record => '| ' + [record.domain, ...amountsFor(record), markdown(rowNote(record)),
478
526
  record.checkout ? '[' + markdown(record.shop ?? 'Check at shop') + '](' + record.checkout + ')' : ''].join(' | ') + ' |'),
479
- '', ...(group.row.verdict ? details(group).map(([label, url]) => '- ' + (url ? '[' + markdown(label) + '](' + url + ')' : markdown(label))) : []),
480
- ...(handleLines(group).length ? ['', '### Handles', '', ...(handlePriority(group, companyType) ? [markdown(handlePriority(group, companyType)), ''] : []), ...handleLines(group).map(([label, url]) =>
481
- '- ' + (url ? '[' + markdown(label) + '](' + url + ')' : markdown(label)))] : []), '']),
527
+ '', ...(group.row.verdict ? details(group).map(line => '- ' + evidenceMarkdown(line)) : []),
528
+ ...(handleLines(group).length ? ['', '### Handles', '', ...(handlePriority(group, companyType) ? [markdown(handlePriority(group, companyType)), ''] : []),
529
+ ...handleLines(group).map(line => '- ' + evidenceMarkdown(line))] : []), '']),
482
530
  ...(sources ? [markdown(sources), ''] : []), ...(note ? [markdown(note), ''] : []), 'You hold the leash.', ''].join('\n');
483
531
  return { html, md };
484
532
  }
@@ -571,16 +619,22 @@ export function resultPages({ env = process.env,
571
619
  return (data, args, { triage = false, watch = false, reuse = null, refresh = false } = {}) => {
572
620
  const work = writes.then(async () => {
573
621
  const at = data.checkedAt ?? new Date().toISOString();
574
- const groups = watch ? [] : resultGroups(data, args.eligible, args.endings);
622
+ let groups = watch || data.hosted ? [] : resultGroups(data, args.eligible, args.endings);
623
+ if (!watch && !triage && !data.hosted && !data.pending) groups = groups.map(group => availabilityScore(group, args));
624
+ if (triage && args.shortlist && !data.pending && groups.some(({ row }) => row.score != null)) {
625
+ groups = groups.filter(({ row }) => Number.isInteger(row.score?.value) && scoreEligible(row))
626
+ .sort((a, b) => compareScores(a.row.score, b.row.score)).slice(0, 8);
627
+ }
575
628
  const selection = receiptSelection(groups, args, triage, args.eligible ?? data.eligible ?? []);
576
- const { lines, savings, shortLines } = watch ? { lines: data.say.split('\n'), savings: [] } : data.pending ? { lines: [
629
+ const { lines, savings, shortLines } = data.hosted ? { lines: data.lines, savings: [] } : watch ? { lines: data.say.split('\n'), savings: [] } : data.pending ? { lines: [
577
630
  ...(data.failed ? ['Some checks did not finish. Registry answers received are on the page.']
578
631
  : ['Still checking trademark, app and web sources. Registry answers so far are on the page.', 'The results page updates by itself.']),
579
632
  ...(args.purchase ? ['This check leaves checkout to you.'] : []),
580
- ], savings: [] } : summary(groups, args, triage, selection);
633
+ ], savings: [] } : groups.length ? summary(groups, args, triage, selection)
634
+ : { lines: ['No names passed the checks.'], savings: [] };
581
635
  // Before the verdicts arrive the receipt recommends nothing, so the link carries only taken rows and jumps.
582
636
  const shareFacts = selection.names.map(name => data.pending ? { taken: name.taken } : name);
583
- const title = watch ? data.domain : groups[0]?.row.name;
637
+ const title = watch ? data.domain : groups[0]?.row.name ?? data.names?.[0]?.name;
584
638
  await mkdir(directory, { recursive: true, mode: 0o700 });
585
639
  // If a caller points us at a shared directory, don't expose the searched name in its listing.
586
640
  const privateListing = process.platform === 'win32' || ((await stat(directory)).mode & 0o077) === 0;
@@ -589,7 +643,9 @@ export function resultPages({ env = process.env,
589
643
  const base = kept ?? new Date().toISOString().replaceAll(/[:.]/g, '-') + '-' + slug + '-' + randomUUID().slice(0, 8);
590
644
  const filename = resolve(directory, base + '.html');
591
645
  const page = render(groups, lines, at, data.sources, watch ? data : null, args.companyType,
592
- { savings, note: watch ? '' : disclosure(data, triage), refresh: Boolean(refresh), shareFacts });
646
+ { savings, note: watch ? '' : data.hosted ? 'Domain Hound’s hosted service checks registries, prices and public name sources.' : disclosure(data, triage),
647
+ refresh: Boolean(refresh), shareFacts,
648
+ hostedShare: data.checks?.length === 1 ? httpsLink(data.checks[0].share?.url) : null });
593
649
  const markdownPath = resolve(directory, base + '.md');
594
650
  await writePrivate(markdownPath, page.md);
595
651
  try {
@@ -598,7 +654,7 @@ export function resultPages({ env = process.env,
598
654
  await unlink(markdownPath).catch(() => {});
599
655
  throw error;
600
656
  }
601
- const exact = !triage && groups.length === 1 && groups[0].row.name.includes('.');
657
+ const exact = !triage && data.names?.length === 1 && data.names[0].name.includes('.');
602
658
  const latest = resolve(directory, 'session-' + session + '.html');
603
659
  if (kept && sessionBase === kept) {
604
660
  // The open tab shows the session copy; update it in place, without opening another tab.
@@ -617,11 +673,22 @@ export function resultPages({ env = process.env,
617
673
  await prune(directory, base).catch(() => {});
618
674
  const url = pathToFileURL(filename).href.replaceAll('(', '%28').replaceAll(')', '%29');
619
675
  // The link uses the client's local-file Markdown form. Keep the file URI for structured consumers.
620
- const say = [resultsLine(url), ...(shortLines ?? lines)].join('\n');
676
+ const handles = data.hosted ? data.checks.flatMap(check => check.nameChecks?.handles ?? [])
677
+ : groups.flatMap(group => group.row.handles ?? []);
678
+ const hints = [...new Set(handles.map(linkedInSearchHint).filter(Boolean))];
679
+ const say = [resultsLine(url), ...(shortLines ?? lines), ...hints].join('\n');
680
+ if (data.hosted) {
681
+ const { hosted, lines, ...structured } = data;
682
+ return { display: say, say, ...structured, resultPage: url };
683
+ }
621
684
  if (triage && args.shortlist) return { display: say, say, checkedAt: at, resultPage: url };
622
685
  const { receiptDetails, say: priorSay, display: priorDisplay, ...structured } = data;
623
686
  if (triage && receiptDetails) structured.names = structured.names.map((row, index) => ({
624
- ...row, details: { ...row.details, sites: receiptDetails[index]?.details?.sites ?? {} },
687
+ ...row, ...(receiptDetails[index]?.score && { score: receiptDetails[index].score }),
688
+ details: { ...row.details, sites: receiptDetails[index]?.details?.sites ?? {} },
689
+ }));
690
+ if (!watch && !triage) structured.names = structured.names.map((row, index) => ({
691
+ ...row, ...(groups[index].row.score && { score: groups[index].row.score }),
625
692
  }));
626
693
  return { display: say, say, ...structured, checkedAt: at, resultPage: url };
627
694
  });
package/server.json CHANGED
@@ -4,12 +4,12 @@
4
4
  "title": "Domain Hound: Domains for agents",
5
5
  "description": "One MCP for everything domains: find, check, buy, set up, watch, move, renew, keep track",
6
6
  "websiteUrl": "https://domainhound.dev",
7
- "version": "0.1.8",
7
+ "version": "0.1.9",
8
8
  "packages": [
9
9
  {
10
10
  "registryType": "npm",
11
11
  "identifier": "domain-hound",
12
- "version": "0.1.8",
12
+ "version": "0.1.9",
13
13
  "transport": {
14
14
  "type": "stdio"
15
15
  }