domain-hound 0.1.2 → 0.1.4
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/.claude-plugin/plugin.json +1 -1
- package/README.md +6 -1
- package/clis/domain-check/company-search.mjs +1 -0
- package/clis/domain-check/confirm.mjs +4 -2
- package/clis/domain-check/index.mjs +91 -23
- package/clis/domain-check/name-search.mjs +96 -17
- package/clis/domain-check/naming-method.mjs +3 -3
- package/clis/domain-check/registry.mjs +149 -36
- package/clis/domain-check/traction.mjs +9 -6
- package/clis/domain-check/triage-sources.mjs +8 -1
- package/clis/domain-check/triage.mjs +69 -31
- package/display.mjs +191 -62
- package/package.json +5 -2
- package/plugin.json +2 -2
- package/results-style.mjs +62 -0
- package/results.mjs +383 -0
- package/server.json +2 -11
- package/server.mjs +66 -40
- package/watch.mjs +93 -0
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 } from './clis/domain-check/name-search.mjs';
|
|
3
|
+
import { canRecommend, eligibilityNeed, 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';
|
|
@@ -25,11 +25,49 @@ export function md(value) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const money = value => '$' + Number(value).toFixed(2);
|
|
28
|
-
|
|
28
|
+
// The DNS label of a screened name: punycode for æøå, never with letters removed.
|
|
29
|
+
const label = name => normalizeName(String(name ?? '')) ?? String(name ?? '').normalize('NFKD').toLowerCase().replace(/[^a-z0-9-]/g, '');
|
|
29
30
|
const fullDomain = (name, d) => d.includes('.') ? d : name + '.' + d;
|
|
30
31
|
const suffix = domain => domain.split('.').at(-1);
|
|
31
32
|
const registered = (row, ending) => row.taken?.includes(ending) || row.resale?.includes(ending);
|
|
32
33
|
const checkoutLimitation = 'Domain Hound cannot buy or complete checkout.';
|
|
34
|
+
const mayBePremium = 'may be premium, price at shop';
|
|
35
|
+
|
|
36
|
+
// A name or domain in its own spelling with the ASCII form registrars use beside it: "grønn.no (xn--grnn-zua.no)".
|
|
37
|
+
export function shown(value) {
|
|
38
|
+
const text = String(value ?? '');
|
|
39
|
+
const unicode = unicodeName(text);
|
|
40
|
+
return unicode ? md(unicode) + ' (' + md(text) + ')' : md(text);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// "not eligible: needs Norwegian org/ID" for a restricted ending the buyer has not said they qualify for.
|
|
44
|
+
function ineligible(ending, eligible) {
|
|
45
|
+
return canRecommend(ending, eligible ?? []) ? null : 'not eligible: needs ' + eligibilityNeed(ending);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// The shop whose search page is the fallback checkout for an ending.
|
|
49
|
+
const fallbackShop = ending => ending === 'no' ? 'dynadot' : ending === 'so' ? 'namecheap' : 'spaceship';
|
|
50
|
+
// A checkout link that is never empty: the given URL when it is a trusted shop search, else the fallback shop search.
|
|
51
|
+
function checkoutLink(url, domain) {
|
|
52
|
+
return safeLink(url, domain) ?? safeLink(shopSearchUrl(fallbackShop(suffix(domain)), domain), domain);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// The renewal jump as a whole multiple, when the renewal is over twice the first payment for the same term.
|
|
56
|
+
// Both payments cover the same number of years (.ai: two), so the payments compare directly.
|
|
57
|
+
export function jumpRatio(price) {
|
|
58
|
+
if (!(price?.now > 0) || price.renew == null) return null;
|
|
59
|
+
const ratio = price.renew / price.now;
|
|
60
|
+
return ratio > 2 ? Math.round(ratio) : null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Payments due in three years and the years they cover: .ai pays two years at a time, so it covers four.
|
|
64
|
+
function threeYears(price) {
|
|
65
|
+
if (price?.now == null || price.renew == null) return null;
|
|
66
|
+
if (price.y3 != null && !(price.term > 1)) return { total: price.y3, years: 3 };
|
|
67
|
+
const term = price.term > 1 ? price.term : 1;
|
|
68
|
+
const renewals = Math.ceil((3 - term) / term);
|
|
69
|
+
return { total: price.y3 ?? Math.round((price.now + renewals * price.renew) * 100) / 100, years: term + renewals * term };
|
|
70
|
+
}
|
|
33
71
|
|
|
34
72
|
function preferredFirst(values, preferred, endingOf = value => value) {
|
|
35
73
|
if (!preferred?.length) return values;
|
|
@@ -40,8 +78,9 @@ function preferredFirst(values, preferred, endingOf = value => value) {
|
|
|
40
78
|
return [...values].sort((a, b) => rank(a) - rank(b));
|
|
41
79
|
}
|
|
42
80
|
|
|
81
|
+
// A data-only shop has no search URL (null), so a missing URL must never match it.
|
|
43
82
|
export function safeLink(url, domain) {
|
|
44
|
-
if (!/^[a-z0-9-]+\.[a-z0-9-]+$/i.test(domain) ||
|
|
83
|
+
if (typeof url !== 'string' || !url || !/^[a-z0-9-]+\.[a-z0-9-]+$/i.test(domain) ||
|
|
45
84
|
!registrarIds.some(id => shopSearchUrl(id, domain) === url)) return null;
|
|
46
85
|
return '[' + domain + '](' + url + ')';
|
|
47
86
|
}
|
|
@@ -52,8 +91,13 @@ function templateLink(templates, shop, domain) {
|
|
|
52
91
|
? safeLink(template.replace('{domain}', encodeURIComponent(domain)), domain) : null;
|
|
53
92
|
}
|
|
54
93
|
|
|
94
|
+
// ".no not eligible: needs Norwegian org/ID." unless the buyer said they qualify.
|
|
55
95
|
function eligibilityLine(result) {
|
|
56
|
-
return Object.
|
|
96
|
+
return Object.keys(result.eligibility ?? {}).map(ending => {
|
|
97
|
+
const need = eligibilityNeed(ending);
|
|
98
|
+
return '.' + ending + (ineligible(ending, result.eligible) ? ' not eligible: needs ' + need + '.'
|
|
99
|
+
: ': eligible, you said you qualify (' + need + ').');
|
|
100
|
+
}).join(' ');
|
|
57
101
|
}
|
|
58
102
|
|
|
59
103
|
// When the live shop check could not run (no Playwright or no browser), the domain still needs a shop check.
|
|
@@ -66,11 +110,25 @@ function liveCheckLine(result, withLink = true) {
|
|
|
66
110
|
+ (check.reason ? ' (' + md(check.reason) + ')' : '') + '. Any prices shown are list estimates.';
|
|
67
111
|
}
|
|
68
112
|
|
|
69
|
-
// ".
|
|
113
|
+
// ".com $9.48/$10.68", with the term when a payment covers more than one year. A renewal over twice the first
|
|
114
|
+
// payment is said in the same place: ".co $3.11, then $31.05/yr, 10x jump".
|
|
115
|
+
function priceText(price) {
|
|
116
|
+
const term = price.term > 1 ? ' ' + price.term + 'y' : '';
|
|
117
|
+
const ratio = jumpRatio(price);
|
|
118
|
+
if (ratio) return money(price.now) + term + ', then ' + money(price.renew) + (term ? '/' + price.term + 'y' : '/yr') + ', ' + ratio + 'x jump';
|
|
119
|
+
return money(price.now) + (price.renew != null ? '/' + money(price.renew) : '') + term;
|
|
120
|
+
}
|
|
121
|
+
|
|
70
122
|
function priced(ending, price) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
123
|
+
return ending + ' ' + (price?.now == null ? 'price at shop' : priceText(price));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// "Best value: lanternbay.com, $30.84 over 3 years" (the lowest total of the payments due in three years).
|
|
127
|
+
function bestValueLine(domain, price) {
|
|
128
|
+
const value = threeYears(price);
|
|
129
|
+
if (!value) return '';
|
|
130
|
+
return 'Best value: ' + shown(domain) + ', ' + money(value.total) + ' over 3 years'
|
|
131
|
+
+ (value.years > 3 ? ' (covers ' + value.years + ' years)' : '');
|
|
74
132
|
}
|
|
75
133
|
|
|
76
134
|
// The date of the oldest list price shown, e.g. "list price from 2026-11-25".
|
|
@@ -87,21 +145,48 @@ function priceLabel(option, shop) {
|
|
|
87
145
|
return premium + 'confirmed at ' + md(shop ?? 'the shop') + clock(option.at);
|
|
88
146
|
}
|
|
89
147
|
|
|
148
|
+
// "Other endings (list prices, availability not checked): .ai $159.96/$159.96 2y · .io $21.40/$53.50 · ..."
|
|
149
|
+
function otherEndingsLine(result) {
|
|
150
|
+
const entries = Object.entries(result.otherEndings ?? {}).filter(([ending, price]) =>
|
|
151
|
+
price?.now != null && !ineligible(ending, result.eligible));
|
|
152
|
+
return entries.length ? 'Other endings (list prices, availability not checked): '
|
|
153
|
+
+ entries.map(([ending, price]) => priced('.' + ending, price)).join(' · ') : '';
|
|
154
|
+
}
|
|
155
|
+
|
|
90
156
|
function exactDisplay(result) {
|
|
91
157
|
const row = result.names?.[0] ?? {};
|
|
92
158
|
const domain = row.name;
|
|
159
|
+
const name = shown(domain);
|
|
93
160
|
const ending = domain.split('.').at(-1);
|
|
94
161
|
const checked = result.checkedAt ? ' Checked ' + String(result.checkedAt).slice(0, 16).replace('T', ' ') + ' UTC.' : '';
|
|
162
|
+
const others = otherEndingsLine(result);
|
|
163
|
+
const tail = others ? [others] : [];
|
|
164
|
+
const notEligible = ineligible(ending, result.eligible);
|
|
165
|
+
const eligibility = result.eligibility ? [eligibilityLine(result)] : [];
|
|
95
166
|
if (registered(row, ending)) {
|
|
96
167
|
const resale = row.resale?.includes(ending) ? ' The owner may list it for resale.' : '';
|
|
97
|
-
|
|
168
|
+
// The ending's standard list price, labelled as a benchmark: this name is not for sale at it.
|
|
169
|
+
const standard = result.listPrices?.[ending];
|
|
170
|
+
const date = listDate(result);
|
|
171
|
+
const showBenchmark = standard?.now != null && !notEligible && (ending === 'ai' || !premiumRisk(domain));
|
|
172
|
+
const term = standard?.term ?? 1;
|
|
173
|
+
const renewal = ending === 'ai' && standard?.renew != null
|
|
174
|
+
? money(standard.renew / term) + '/yr renewal, billed as ' + money(standard.renew) + ' every ' + term + ' years'
|
|
175
|
+
: showBenchmark ? priceText(standard) : '';
|
|
176
|
+
const benchmark = showBenchmark
|
|
177
|
+
? ['Standard .' + ending + ' list price (benchmark' + (date ? ' from ' + date : '') + ', USD ex. VAT): ' + renewal + '.']
|
|
178
|
+
: [];
|
|
179
|
+
return ['**' + name + ' is taken, and ' + checkoutLimitation + '**' + resale + checked, ...benchmark, ...tail].join('\n');
|
|
98
180
|
}
|
|
99
181
|
const free = row.free?.find(option => option.d === ending);
|
|
100
182
|
if (free?.s === 'prem') {
|
|
183
|
+
if (notEligible) return ['**' + name + ' is free at the registry.** ' + notEligible + '.' + checked, ...tail].join('\n');
|
|
101
184
|
const shop = free.shop ?? Object.keys(result.buyUrlTemplate ?? {})[0];
|
|
102
185
|
const link = templateLink(result.buyUrlTemplate, shop, domain);
|
|
103
|
-
|
|
104
|
-
|
|
186
|
+
const head = free.risk ? '**' + name + ' is free at the registry.** May be premium, price at shop'
|
|
187
|
+
: '**' + name + ' is free at the registry, but premium.** Premium, price at shop';
|
|
188
|
+
return [head + (link ? ': ' + link : '') + '.' + (free.risk ? ' No list price shown.' : ' No list price applies.') + checked,
|
|
189
|
+
...eligibility, ...tail].join('\n');
|
|
105
190
|
}
|
|
106
191
|
if (free) {
|
|
107
192
|
const confirmed = free.s === 'ok';
|
|
@@ -111,63 +196,72 @@ function exactDisplay(result) {
|
|
|
111
196
|
const shop = offer.shop ?? best?.shop;
|
|
112
197
|
const link = safeLink(best?.buyUrl, domain) ?? templateLink(result.buyUrlTemplate, shop, domain);
|
|
113
198
|
const term = offer.term > 1 ? ' for ' + offer.term + ' years' : '';
|
|
114
|
-
const live = !confirmed && result.liveCheck?.domain === domain ? liveCheckLine(result) : '';
|
|
199
|
+
const live = !notEligible && !confirmed && result.liveCheck?.domain === domain ? liveCheckLine(result) : '';
|
|
115
200
|
const date = listDate(result);
|
|
201
|
+
const ratio = jumpRatio(offer);
|
|
202
|
+
const checkout = notEligible ?? (link ? link + (shop ? ' at ' + md(shop) : '') : '—');
|
|
116
203
|
const lines = [
|
|
117
|
-
'**' +
|
|
204
|
+
'**' + name + (free.prem ? ' is free, at a premium price.** ' : ' is free.** ')
|
|
118
205
|
+ (confirmed ? 'Price ' + priceLabel(free, shop) + '.'
|
|
119
206
|
: 'The registry shows it free; the price is a list price' + (offer.now != null && date ? ' from ' + date : '')
|
|
120
207
|
+ ', not a shop quote.') + checked,
|
|
121
208
|
'',
|
|
122
209
|
'| Domain | Today | Renewal | 3 years | Checkout |',
|
|
123
210
|
'|---|---|---|---|---|',
|
|
124
|
-
'| ' +
|
|
125
|
-
+ (offer.renew != null ? money(offer.renew) + (offer.term > 1 ? term : '/yr') : '—') + (
|
|
126
|
-
+ ' | ' + (offer.y3 != null ? money(offer.y3) : '—') + ' | ' +
|
|
211
|
+
'| ' + name + ' | ' + (offer.now != null ? money(offer.now) + term : 'price at shop') + ' | '
|
|
212
|
+
+ (offer.renew != null ? money(offer.renew) + (offer.term > 1 ? term : '/yr') : '—') + (ratio ? ', ' + ratio + 'x jump' : '')
|
|
213
|
+
+ ' | ' + (offer.y3 != null ? money(offer.y3) : '—') + ' | ' + checkout + ' |',
|
|
127
214
|
'',
|
|
128
215
|
...(live ? [live] : []),
|
|
129
216
|
'USD ex. VAT.' + (confirmed ? '' : ' Estimate: the shop shows the final price.'),
|
|
130
|
-
...
|
|
217
|
+
...eligibility,
|
|
218
|
+
...tail,
|
|
131
219
|
];
|
|
132
220
|
return lines.join('\n');
|
|
133
221
|
}
|
|
222
|
+
if (notEligible) return ['**' + name + ': ' + notEligible + '.**' + checked, ...tail].join('\n');
|
|
134
223
|
const why = result.shopCheckWhy?.[domain] ?? result.shopCheckWhy?.[ending];
|
|
135
224
|
const shop = Object.keys(result.buyUrlTemplate ?? {})[0];
|
|
136
225
|
const link = templateLink(result.buyUrlTemplate, shop, domain);
|
|
137
226
|
if (result.shopCheckWhy?.[domain]) {
|
|
138
227
|
// Reserved or not offered: no list price applies.
|
|
139
|
-
return '**' +
|
|
228
|
+
return ['**' + name + ': not offered for registration.** ' + md(why) + '. Check at shop' + (link ? ': ' + link : '') + '.' + checked,
|
|
229
|
+
...tail].join('\n');
|
|
140
230
|
}
|
|
141
231
|
const live = result.liveCheck?.domain === domain ? liveCheckLine(result, !link) : '';
|
|
142
232
|
const estimate = result.listPrices?.[ending];
|
|
143
233
|
const date = listDate(result);
|
|
144
|
-
const hasEstimate = estimate?.now != null && date;
|
|
145
|
-
|
|
146
|
-
|
|
234
|
+
const hasEstimate = estimate?.now != null && date && !premiumRisk(domain);
|
|
235
|
+
// DNS is a likelihood only; the registry or the shop settles it.
|
|
236
|
+
const likely = row.likely_free?.includes(ending) ? ' Likely free (DNS), confirm at shop.'
|
|
237
|
+
: row.likely_taken?.includes(ending) ? ' Likely taken (DNS).' : '';
|
|
238
|
+
const risk = premiumRisk(domain) ? ' A short name ' + mayBePremium + '.' : '';
|
|
239
|
+
return ['**' + name + ': not settled.** The registry did not settle it' + (why ? ' (' + md(why) + ')' : '') + '.' + likely
|
|
240
|
+
+ ' Check at shop' + (link ? ': ' + link : '') + '.' + risk + (hasEstimate || risk ? '' : ' No price yet.') + checked,
|
|
147
241
|
...(hasEstimate ? [
|
|
148
242
|
priced('.' + ending, estimate) + ' at ' + md(estimate.shop) + ' (USD ex. VAT, list price from ' + date + ').',
|
|
149
|
-
...
|
|
243
|
+
...eligibility,
|
|
150
244
|
] : []),
|
|
151
|
-
...(live ? [live] : [])].join('\n');
|
|
245
|
+
...(live ? [live] : []), ...tail].join('\n');
|
|
152
246
|
}
|
|
153
247
|
|
|
154
|
-
// One line per free domain, so a copied answer cannot merge or drop an ending.
|
|
248
|
+
// One line per free domain, so a copied answer cannot merge or drop an ending. Each price appears once.
|
|
155
249
|
// Level 1 drops the "list price" word (the header says it); level 2 leaves standard prices to the shared line;
|
|
156
250
|
// level 3, for the densest batches, names each name once above its own ending lines.
|
|
157
|
-
function freeLines(row, listPrices, level) {
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
251
|
+
function freeLines(row, listPrices, level, eligible) {
|
|
252
|
+
return (row.free ?? []).map(option => {
|
|
253
|
+
const full = option.d.includes('.') ? option.d : row.name.includes('.') ? row.name : row.name + '.' + option.d;
|
|
254
|
+
const domain = level >= 3 && !option.d.includes('.') && !row.name.includes('.') ? '.' + option.d : shown(full);
|
|
255
|
+
const blocked = ineligible(suffix(full), eligible);
|
|
256
|
+
if (blocked) return '- ' + domain + ' ' + blocked;
|
|
257
|
+
if (option.s === 'prem') return '- ' + domain + ' ' + (option.risk ? mayBePremium : 'premium, price at shop');
|
|
162
258
|
const own = option.now != null;
|
|
163
259
|
if (!own && level >= 2) return '- ' + domain;
|
|
164
260
|
const quote = own ? option : listPrices[option.d];
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return '- ' + domain + price + label;
|
|
261
|
+
const listed = jumpRatio(quote) ? ' (list price)' : ' list price';
|
|
262
|
+
const tag = option.s === 'ok' ? ' ✓ ' + priceLabel(option, option.shop) : level >= 1 || quote?.now == null ? '' : listed;
|
|
263
|
+
return '- ' + domain + ' ' + (quote?.now == null ? 'price at shop' : priceText(quote)) + tag;
|
|
169
264
|
});
|
|
170
|
-
return lines;
|
|
171
265
|
}
|
|
172
266
|
|
|
173
267
|
function groupRows(rows, linesFor) {
|
|
@@ -177,21 +271,40 @@ function groupRows(rows, linesFor) {
|
|
|
177
271
|
if (!lines.length) continue;
|
|
178
272
|
const key = lines.join('\n');
|
|
179
273
|
if (!groups.has(key)) groups.set(key, { names: [], lines });
|
|
180
|
-
groups.get(key).names.push(
|
|
274
|
+
groups.get(key).names.push(shown(row.name));
|
|
181
275
|
}
|
|
182
276
|
return [...groups.values()];
|
|
183
277
|
}
|
|
184
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 => {
|
|
282
|
+
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 price = option.now != null ? option : listPrices[option.d];
|
|
285
|
+
return price?.now != null ? [{ domain, price, value: threeYears(price)?.total ?? Infinity }] : [];
|
|
286
|
+
});
|
|
287
|
+
if (!options.length) return [];
|
|
288
|
+
const cheapest = options.reduce((best, row) => row.price.now < best.price.now ? row : best);
|
|
289
|
+
const value = options.reduce((best, row) => row.value < best.value
|
|
290
|
+
|| (row.value === best.value && row.price.now < best.price.now) ? row : best);
|
|
291
|
+
return ['Cheapest now: ' + shown(cheapest.domain), ...(value.value < Infinity ? [bestValueLine(value.domain, value.price)] : [])];
|
|
292
|
+
}
|
|
293
|
+
|
|
185
294
|
export function checkDisplay(result, level = 0, purchase = false) {
|
|
186
295
|
const rows = (result.names ?? []).filter(Boolean);
|
|
187
296
|
if (rows.length === 1 && rows[0].name?.includes('.')) return exactDisplay(result);
|
|
188
297
|
const listPrices = result.listPrices ?? {};
|
|
298
|
+
const eligible = result.eligible ?? [];
|
|
299
|
+
// The shared line carries a standard price only where no free line shows it: free endings from level 2 on, and
|
|
300
|
+
// endings left to a shop check. Short names may be premium, so their open endings add no list price.
|
|
189
301
|
const standard = new Set();
|
|
190
302
|
for (const row of rows) {
|
|
191
|
-
for (const option of row.free ?? []) if (option.now == null && option.s !== 'prem') standard.add(option.d);
|
|
303
|
+
for (const option of row.free ?? []) if (level >= 2 && option.now == null && option.s !== 'prem') standard.add(option.d);
|
|
304
|
+
if (premiumRisk(row.name)) continue;
|
|
192
305
|
for (const d of row.shop_check ?? []) if (listPrices[d]?.now != null) standard.add(d);
|
|
193
306
|
}
|
|
194
|
-
const shared = [...standard].filter(d => !d.includes('.') && listPrices[d])
|
|
307
|
+
const shared = [...standard].filter(d => !d.includes('.') && listPrices[d] && !ineligible(d, eligible))
|
|
195
308
|
.map(d => priced('.' + d, listPrices[d])).join(' · ');
|
|
196
309
|
const lines = [
|
|
197
310
|
'**Domain check, ' + rows.length + (rows.length === 1 ? ' name' : ' names') + '** (USD ex. VAT, today/renewal; '
|
|
@@ -201,20 +314,26 @@ export function checkDisplay(result, level = 0, purchase = false) {
|
|
|
201
314
|
if (shared) lines.push('Standard prices: ' + shared);
|
|
202
315
|
if (result.eligibility) lines.push(eligibilityLine(result));
|
|
203
316
|
const free = level >= 3
|
|
204
|
-
? groupRows(rows, row => freeLines(row, listPrices, level))
|
|
317
|
+
? groupRows(rows, row => freeLines(row, listPrices, level, eligible))
|
|
205
318
|
.flatMap(group => [group.names.join(', ') + ':', ...group.lines])
|
|
206
|
-
: rows.flatMap(row => freeLines(row, listPrices, level));
|
|
319
|
+
: rows.flatMap(row => freeLines(row, listPrices, level, eligible));
|
|
207
320
|
lines.push('', '**Free domains, one ending per line**' + (free.length ? '' : ': none found'), ...free, '');
|
|
208
321
|
const endingsOf = (row, key) => (row[key] ?? []).map(d => d.includes('.') ? d : '.' + d);
|
|
209
322
|
const statusLines = project => level >= 3
|
|
210
323
|
? groupRows(rows, project).map(group => group.names.join(', ') + ' ' + group.lines.join(' '))
|
|
211
324
|
: rows.flatMap(row => {
|
|
212
325
|
const endings = project(row);
|
|
213
|
-
return endings.length ? [
|
|
326
|
+
return endings.length ? [shown(row.name) + ' ' + endings.join(' ')] : [];
|
|
214
327
|
});
|
|
328
|
+
const likely = row => new Set([...(row.likely_free ?? []), ...(row.likely_taken ?? [])]);
|
|
215
329
|
const taken = statusLines(row => [...endingsOf(row, 'taken'), ...endingsOf(row, 'resale').map(d => d + ' (resale)')]);
|
|
216
|
-
const
|
|
330
|
+
const likelyTaken = statusLines(row => endingsOf(row, 'likely_taken'));
|
|
331
|
+
const likelyFree = statusLines(row => endingsOf(row, 'likely_free'));
|
|
332
|
+
const check = statusLines(row => endingsOf({ open: (row.shop_check ?? []).filter(d => !likely(row).has(d)) }, 'open'));
|
|
217
333
|
if (taken.length) lines.push('Taken: ' + taken.join(' · '));
|
|
334
|
+
// DNS is a likelihood only; the registry or the shop settles these.
|
|
335
|
+
if (likelyTaken.length) lines.push('Likely taken (DNS): ' + likelyTaken.join(' · '));
|
|
336
|
+
if (likelyFree.length) lines.push('Likely free (DNS), confirm at shop: ' + likelyFree.join(' · '));
|
|
218
337
|
if (check.length) lines.push('Check at shop: ' + check.join(' · '));
|
|
219
338
|
const reasons = new Map();
|
|
220
339
|
for (const [ending, reason] of Object.entries(result.shopCheckWhy ?? {})) {
|
|
@@ -223,12 +342,12 @@ export function checkDisplay(result, level = 0, purchase = false) {
|
|
|
223
342
|
}
|
|
224
343
|
for (const [reason, endings] of reasons) lines.push(endings.join(', ') + ' — ' + md(reason) + '.');
|
|
225
344
|
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));
|
|
226
346
|
const best = result.best;
|
|
227
347
|
const link = best && safeLink(best.buyUrl, best.domain);
|
|
228
348
|
if (link) {
|
|
229
349
|
lines.push('Confirmed at ' + md(best.shop ?? 'the shop') + clock(best.at) + ': ' + link + ' '
|
|
230
|
-
+ (best.priceNow != null ?
|
|
231
|
-
+ (best.renewal != null ? '/' + money(best.renewal) : '') + (best.term > 1 ? ' ' + best.term + 'y' : '') + '.');
|
|
350
|
+
+ (best.priceNow != null ? priceText({ now: best.priceNow, renew: best.renewal, term: best.term }) : 'price at shop') + '.');
|
|
232
351
|
lines.push(neverBuys);
|
|
233
352
|
} else if (result.liveCheck) {
|
|
234
353
|
const live = liveCheckLine(result);
|
|
@@ -236,7 +355,7 @@ export function checkDisplay(result, level = 0, purchase = false) {
|
|
|
236
355
|
} else if (rows.length === 1 || purchase) {
|
|
237
356
|
const available = rows.flatMap(row => (row.free ?? []).flatMap(option => {
|
|
238
357
|
const domain = option.d.includes('.') ? option.d : row.name.includes('.') ? row.name : row.name + '.' + option.d;
|
|
239
|
-
if (!canRecommend(domain.split('.').at(-1))) return [];
|
|
358
|
+
if (!canRecommend(domain.split('.').at(-1), eligible)) return [];
|
|
240
359
|
const price = option.prem || option.s === 'prem' ? option : { ...listPrices[option.d], ...option };
|
|
241
360
|
const link = templateLink(result.buyUrlTemplate, price.shop, domain);
|
|
242
361
|
return link ? [{ link, price: price.now ?? Infinity }] : [];
|
|
@@ -247,12 +366,6 @@ export function checkDisplay(result, level = 0, purchase = false) {
|
|
|
247
366
|
return lines.join('\n').trim();
|
|
248
367
|
}
|
|
249
368
|
|
|
250
|
-
function bestValueLine(domain, quote) {
|
|
251
|
-
if (quote?.now == null || quote.renew == null) return '';
|
|
252
|
-
const term = quote.term > 1 ? ' (each payment covers ' + quote.term + ' years)' : '';
|
|
253
|
-
return 'Best value: ' + md(domain) + ' ' + money(quote.now) + ' now, ' + money(quote.renew) + ' renewal' + term;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
369
|
function rowBestValue(row, prices) {
|
|
257
370
|
const ending = row?.bestValue;
|
|
258
371
|
return ending ? bestValueLine(fullDomain(label(row.name), ending), row.own?.[ending] ?? prices?.[ending]) : '';
|
|
@@ -305,14 +418,20 @@ export function topPicks(result) {
|
|
|
305
418
|
return picks;
|
|
306
419
|
}
|
|
307
420
|
|
|
421
|
+
// A screened name as typed, with its DNS label beside it when that is punycode: "Grønnstue (xn--grnnstue-64a)".
|
|
422
|
+
function nameLabel(name) {
|
|
423
|
+
const dns = label(name);
|
|
424
|
+
return md(name) + (dns.startsWith('xn--') ? ' (' + md(dns) + ')' : '');
|
|
425
|
+
}
|
|
426
|
+
|
|
308
427
|
function topLines(result, showReason, showValue = true) {
|
|
309
428
|
return ['**Top picks**', ...topPicks(result).map(row => {
|
|
310
|
-
const ending = row.domain
|
|
311
|
-
const domain = ending ? ', ' + priced(ending, row) : ', no eligible free ending';
|
|
429
|
+
const ending = row.domain ? shown(row.domain) : row.ending && '.' + row.ending;
|
|
430
|
+
const domain = ending ? ', cheapest now ' + priced(ending, row) : ', no eligible free ending';
|
|
312
431
|
const value = !showValue ? '' : typeof row.bestValue === 'string'
|
|
313
432
|
? rowBestValue(result.names.find(candidate => candidate.name === row.name), result.prices)
|
|
314
433
|
: row.bestValue && bestValueLine(row.bestValue.domain, row.bestValue);
|
|
315
|
-
return '- **' +
|
|
434
|
+
return '- **' + nameLabel(row.name) + '** — ' + md(row.verdict) + domain + (showReason ? '. ' + md(row.reason) : '')
|
|
316
435
|
+ (value ? ' \n ' + value : '');
|
|
317
436
|
})];
|
|
318
437
|
}
|
|
@@ -349,14 +468,16 @@ export function triageDisplay(result, prior, { short = false, compact = false, p
|
|
|
349
468
|
for (const row of rows) {
|
|
350
469
|
const base = label(row.name);
|
|
351
470
|
const free = Array.isArray(row.free) ? row.free : [];
|
|
352
|
-
const first = free.find(ending => canRecommend(ending, result.eligible));
|
|
353
|
-
const link = first && base ? safeLink(row.buy, fullDomain(base, first)) : null;
|
|
354
|
-
const checkoutPrice = prior && link && (row.own?.[first] ?? prices[first]);
|
|
355
471
|
const earlier = earlierRows.get(base) ?? [];
|
|
356
472
|
// An earlier premium answer, or a shop quote above the list price, replaces the list price for that ending.
|
|
357
473
|
const premiumQuote = ending => earlier.find(option => option.d === ending && (option.s === 'prem' || option.prem ||
|
|
358
474
|
(option.s === 'ok' && option.now != null && option.now > ((row.own?.[ending] ?? prices[ending])?.now ?? Infinity) + 0.01)));
|
|
475
|
+
const first = free.find(ending => canRecommend(ending, result.eligible) && !premiumQuote(ending));
|
|
476
|
+
// The checkout always links a real shop search; it never renders an empty link.
|
|
477
|
+
const link = first && base ? checkoutLink(row.buy, fullDomain(base, first)) : null;
|
|
359
478
|
const cell = preferredFirst(free, preferred).map(ending => {
|
|
479
|
+
const blocked = ineligible(ending, result.eligible);
|
|
480
|
+
if (blocked) return '.' + ending + ' ' + blocked;
|
|
360
481
|
const own = row.own?.[ending];
|
|
361
482
|
const premium = premiumQuote(ending);
|
|
362
483
|
if (premium) {
|
|
@@ -370,17 +491,24 @@ export function triageDisplay(result, prior, { short = false, compact = false, p
|
|
|
370
491
|
const taken = earlier.filter(option => row.taken?.includes(option.d));
|
|
371
492
|
const exact = earlier.filter(option => option.s === 'ok' && free.includes(option.d) && !premiumQuote(option.d) &&
|
|
372
493
|
option.now !== (row.own?.[option.d] ?? prices[option.d])?.now);
|
|
373
|
-
|
|
374
|
-
|
|
494
|
+
const likely = new Set([...(row.likely_free ?? []), ...(row.likely_taken ?? [])]);
|
|
495
|
+
const groups = {
|
|
496
|
+
premium: row.premium, taken: row.taken, likely_taken: row.likely_taken, likely_free: row.likely_free,
|
|
497
|
+
shop_check: row.shop_check?.filter(ending => !likely.has(ending)),
|
|
498
|
+
};
|
|
499
|
+
for (const [key, heading] of [['premium', premiumRisk(base) ? mayBePremium : 'premium, price at shop'], ['taken', 'taken'],
|
|
500
|
+
['likely_taken', 'likely taken (DNS)'], ['likely_free', 'likely free (DNS), confirm at shop'], ['shop_check', 'check at shop']]) {
|
|
501
|
+
if (groups[key]?.length) cell.push(heading + ': ' + preferredFirst(groups[key], preferred).map(ending => '.' + ending).join(' '));
|
|
375
502
|
}
|
|
376
503
|
if (!compact && recheck.length) cell.push('earlier price, recheck: ' + recheck.map(previous).join(', '));
|
|
377
504
|
if (!compact && taken.length) cell.push('earlier price, now taken: ' + taken.map(previous).join(', '));
|
|
378
505
|
if (!compact && exact.length) cell.push('earlier shop quote: ' + exact.map(previous).join(', '));
|
|
379
|
-
|
|
506
|
+
// The price stays on the ending's own line, so the checkout cell carries only the link.
|
|
507
|
+
const checkout = compact ? '—' : link ?? '—';
|
|
380
508
|
const value = !compact && rowBestValue(row, prices);
|
|
381
509
|
const reason = compact ? shorten(String(row.reason ?? '').split(' · ', 1)[0], 80) : row.reason;
|
|
382
510
|
const checks = compact ? checkLines(row, false).map(line => line.split(' · [search]', 1)[0]) : checkLines(row, short);
|
|
383
|
-
lines.push('| ' +
|
|
511
|
+
lines.push('| ' + nameLabel(row.name) + ' | ' + md(row.verdict) + ': ' + md(reason) + (compact ? '' : tractionLine(row, Boolean(prior) || short)) + ' | '
|
|
384
512
|
+ (cell.join('<br>') || 'none free') + (value ? '<br>' + value : '') + ' | ' + checkout + ' | '
|
|
385
513
|
+ checks.join('<br>') + ' |');
|
|
386
514
|
}
|
|
@@ -395,7 +523,7 @@ function denseDisplay(result, short = false, links = true) {
|
|
|
395
523
|
const results = (result.names ?? []).filter(Boolean);
|
|
396
524
|
const checksFor = row => checkLines(row, short).map(line =>
|
|
397
525
|
links ? line : line.replace(/\[([^\]]+)\]\(https:\/\/[^)]+\)/g, '$1'));
|
|
398
|
-
const names = results.map(row => '- **' +
|
|
526
|
+
const names = results.map(row => '- **' + nameLabel(row.name) + '** — ' + md(row.verdict));
|
|
399
527
|
const individual = names.map((name, index) => name + ' \n ' + checksFor(results[index]).join(' \n '));
|
|
400
528
|
const groups = links ? [] : groupRows(results, checksFor);
|
|
401
529
|
const shared = groups.flatMap(({ names, lines }) => [
|
|
@@ -506,7 +634,8 @@ export function checkText(result, shortlist = false, { purchase = false, preferr
|
|
|
506
634
|
}
|
|
507
635
|
const groups = new Map();
|
|
508
636
|
for (const row of data.names) {
|
|
509
|
-
const free = (row.free ?? []).map(option => '.' + option.d
|
|
637
|
+
const free = (row.free ?? []).map(option => '.' + option.d
|
|
638
|
+
+ (option.risk ? ' (may be premium)' : option.s === 'prem' || option.prem ? ' (premium)' : ''));
|
|
510
639
|
const statuses = ['Free ' + (free.join(' ') || 'none found')];
|
|
511
640
|
for (const [key, heading] of [['taken', 'taken'], ['resale', 'resale'], ['shop_check', 'check at shop']]) {
|
|
512
641
|
if (row[key]?.length) statuses.push(heading + ' ' + row[key].map(ending => '.' + ending).join(' '));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "domain-hound",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Check domains, compare registrar prices, and screen product names from your MCP client.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
"bin/domain-hound.mjs",
|
|
27
27
|
"server.mjs",
|
|
28
28
|
"display.mjs",
|
|
29
|
+
"results.mjs",
|
|
30
|
+
"results-style.mjs",
|
|
31
|
+
"watch.mjs",
|
|
29
32
|
"clis/domain-check/cache.mjs",
|
|
30
33
|
"clis/domain-check/com-site.mjs",
|
|
31
34
|
"clis/domain-check/company-search.mjs",
|
|
@@ -54,7 +57,7 @@
|
|
|
54
57
|
"server.json"
|
|
55
58
|
],
|
|
56
59
|
"scripts": {
|
|
57
|
-
"test": "node --test server.test.mjs clis/domain-check/*.test.mjs clis/domain-check/test.mjs",
|
|
60
|
+
"test": "node --test server.test.mjs results.test.mjs clis/domain-check/*.test.mjs clis/domain-check/test.mjs",
|
|
58
61
|
"smoke": "node scripts/smoke.mjs",
|
|
59
62
|
"snapshot-prices": "node scripts/snapshot-prices.mjs",
|
|
60
63
|
"build-mcpb": "node scripts/build-mcpb.mjs"
|
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.
|
|
4
|
+
"version": "0.1.4",
|
|
5
5
|
"description": "Check domain availability and prices, and screen product names, from your AI assistant.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Lars Hvinden"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"interface": {
|
|
14
14
|
"displayName": "Domain Hound",
|
|
15
15
|
"shortDescription": "Domain prices and name checks",
|
|
16
|
-
"longDescription": "Domain Hound is a local MCP server that helps you pick a product name and the best domain. It checks real registry availability, finds the cheapest trusted shop including the renewal price, and screens names for trademark conflicts, app store clashes and web traction. It has
|
|
16
|
+
"longDescription": "Domain Hound is a local MCP server that helps you pick a product name and the best domain. It checks real registry availability, finds the cheapest trusted shop including the renewal price, and screens names for trademark conflicts, app store clashes and web traction. It has four tools: check_domains, triage_names, naming_method and watch_domain. It runs on your machine over stdio, needs no account, and is open source under the MIT license.",
|
|
17
17
|
"developerName": "Lars Hvinden",
|
|
18
18
|
"category": "Developer Tools",
|
|
19
19
|
"capabilities": [
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Domain Hound's brand B receipt, designed for the same table at phone and desktop widths.
|
|
2
|
+
export const receiptStyle = `
|
|
3
|
+
:root {
|
|
4
|
+
color-scheme: light;
|
|
5
|
+
--blue: #102385;
|
|
6
|
+
--gold: #f4c64f;
|
|
7
|
+
--cream: #fff7de;
|
|
8
|
+
--lime: #cdf473;
|
|
9
|
+
--coral: #ffab91;
|
|
10
|
+
--mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
|
|
11
|
+
}
|
|
12
|
+
* { box-sizing: border-box; }
|
|
13
|
+
body {
|
|
14
|
+
margin: 0;
|
|
15
|
+
background: var(--cream);
|
|
16
|
+
color: var(--blue);
|
|
17
|
+
font: 400 1.0625rem/1.5 Mulish, system-ui, sans-serif;
|
|
18
|
+
overflow-wrap: anywhere;
|
|
19
|
+
}
|
|
20
|
+
main { width: min(calc(100% - 2rem), 56rem); margin: 1rem auto 3rem; }
|
|
21
|
+
main > header {
|
|
22
|
+
padding: .875rem 1rem;
|
|
23
|
+
background: var(--blue);
|
|
24
|
+
color: var(--cream);
|
|
25
|
+
border-bottom: .3rem solid var(--gold);
|
|
26
|
+
}
|
|
27
|
+
header small, time, code { font-family: var(--mono); }
|
|
28
|
+
header small { color: var(--gold); font-weight: 700; }
|
|
29
|
+
h1, h2 { margin: 0; font-weight: 900; line-height: 1.12; letter-spacing: -.035em; }
|
|
30
|
+
h1 { margin-block: .2rem; font-size: clamp(2rem, 4vw, 2.75rem); }
|
|
31
|
+
h2 { font-size: 1.65rem; }
|
|
32
|
+
p { max-width: 62ch; margin: .35rem 0; }
|
|
33
|
+
main > section, article, footer { margin-top: 1.25rem; padding-top: 1rem; border-top: 2px solid var(--blue); }
|
|
34
|
+
.comparison { display: grid; gap: 2px; margin-block: .875rem; border: 2px solid var(--blue); background: var(--blue); }
|
|
35
|
+
.comparison > * { min-width: 0; margin: 0; padding: .6rem .8rem; background: var(--gold); }
|
|
36
|
+
.comparison > :last-child { background: var(--lime); }
|
|
37
|
+
nav { display: flex; flex-wrap: wrap; gap: 0 1rem; margin-top: 1rem; }
|
|
38
|
+
a, a:visited { color: inherit; text-underline-offset: .18em; }
|
|
39
|
+
nav a, summary { padding-block: .6rem; }
|
|
40
|
+
:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }
|
|
41
|
+
table { width: 100%; table-layout: fixed; border-collapse: collapse; margin-block: .75rem; }
|
|
42
|
+
caption { padding-bottom: .35rem; text-align: left; font-weight: 750; }
|
|
43
|
+
th, td { padding: .5rem .4rem; border-bottom: 1px solid var(--blue); text-align: left; vertical-align: top; }
|
|
44
|
+
thead { background: var(--blue); color: var(--cream); }
|
|
45
|
+
thead th:first-child { width: 50%; }
|
|
46
|
+
thead th:nth-child(n+2), tbody td { text-align: right; }
|
|
47
|
+
tbody td { font-variant-numeric: lining-nums tabular-nums; }
|
|
48
|
+
th[scope="row"] code { display: block; font-weight: 800; }
|
|
49
|
+
th[scope="row"] small { display: block; font: 400 .9375rem/1.45 system-ui, sans-serif; }
|
|
50
|
+
details { border-bottom: 1px dashed var(--blue); }
|
|
51
|
+
summary { cursor: pointer; font-weight: 750; }
|
|
52
|
+
details[open] { padding-bottom: .65rem; }
|
|
53
|
+
footer { font-size: .9375rem; }
|
|
54
|
+
@media (min-width: 48rem) {
|
|
55
|
+
body { font-size: 1.125rem; }
|
|
56
|
+
main { margin-top: 2rem; }
|
|
57
|
+
main > header { padding: 1rem 1.25rem; }
|
|
58
|
+
.comparison { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
59
|
+
thead th:first-child { width: 56%; }
|
|
60
|
+
th, td { padding: .55rem .85rem; }
|
|
61
|
+
}
|
|
62
|
+
`;
|