@operstack/audit 0.27.0 → 0.29.0
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/package.json +2 -2
- package/src/visibility.mjs +56 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operstack/audit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "SEO, AEO and GEO audit generator: collect public signals from a site into audit.json, let an analyst or an agent fill the narrative, render the OperStack report as HTML and PDF.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"LICENSE"
|
|
30
30
|
],
|
|
31
31
|
"scripts": {
|
|
32
|
-
"test": "node src/test-scores.mjs && node src/test-fix.mjs && node src/test-foundation.mjs && node src/test-narrative.mjs && node src/test-prompts.mjs && node src/test-sitemap.mjs && node src/test-overall.mjs && node src/test-blocked.mjs && node src/test-unmeasured.mjs && node src/test-rendered.mjs && node src/test-sample.mjs && node src/test-demand.mjs && node src/test-agent-surface.mjs && node src/test-agency.mjs && node src/test-i18n.mjs examples/sample-audit.json && node bin/audit.mjs check examples/sample-audit.json && node bin/audit.mjs render examples/sample-audit.json --out /tmp/operstack-audit-sample.html && node src/test-ru-sources.mjs && node src/test-sample-fairness.mjs && node test-engines.mjs",
|
|
32
|
+
"test": "node src/test-scores.mjs && node src/test-fix.mjs && node src/test-foundation.mjs && node src/test-narrative.mjs && node src/test-prompts.mjs && node src/test-sitemap.mjs && node src/test-overall.mjs && node src/test-blocked.mjs && node src/test-unmeasured.mjs && node src/test-rendered.mjs && node src/test-sample.mjs && node src/test-demand.mjs && node src/test-agent-surface.mjs && node src/test-agency.mjs && node src/test-i18n.mjs examples/sample-audit.json && node bin/audit.mjs check examples/sample-audit.json && node bin/audit.mjs render examples/sample-audit.json --out /tmp/operstack-audit-sample.html && node src/test-ru-sources.mjs && node src/test-sample-fairness.mjs && node test-engines.mjs && node test-seo-basics.mjs",
|
|
33
33
|
"sample": "node bin/audit.mjs render examples/sample-audit.json --pdf",
|
|
34
34
|
"verify:live": "node src/verify-live.mjs"
|
|
35
35
|
},
|
package/src/visibility.mjs
CHANGED
|
@@ -50,24 +50,27 @@ const AI_AGENTS = [
|
|
|
50
50
|
* измерили, и под каждым движком видно, из чего оно сложилось. Это принципиально: конкурент
|
|
51
51
|
* показывает такие числа без объяснения, откуда они, и мы за это его же и критикуем.
|
|
52
52
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
53
|
+
* Формула здесь ТА ЖЕ, что у общего балла, и это принципиально. В первой версии я дал двум
|
|
54
|
+
* группам движков разные веса: у тех, кто достаёт страницу живьём, тяжелее доступ, у тех, кто
|
|
55
|
+
* отвечает из индекса, тяжелее разметка. Обоснование звучало складно, но замером не было: это
|
|
56
|
+
* было моё допущение, то есть ровно то, за что мы критикуем конкурента, который показывает такие
|
|
57
|
+
* числа без объяснения, откуда они.
|
|
58
|
+
*
|
|
59
|
+
* Поэтому веса взяты один в один из общего балла, а отличаются движки друг от друга только одним
|
|
60
|
+
* и настоящим: что robots.txt отвечает ИХ собственным роботам. У сайта, который никого не закрыл,
|
|
61
|
+
* все пять чисел совпадут с общим баллом, и это правда, а не скучная правда вместо красивой лжи.
|
|
58
62
|
*
|
|
59
63
|
* Неизмеренная область в расчёт не идёт вовсе, и оставшиеся веса делятся заново. Правило то же,
|
|
60
64
|
* что и у общего балла: не измерили, значит не считаем ни в плюс, ни в минус.
|
|
61
65
|
*/
|
|
62
|
-
const
|
|
63
|
-
const INDEX_MIX = Object.freeze({ access: 0.30, entity: 0.30, content: 0.25, trust: 0.15 });
|
|
66
|
+
const SCORE_MIX = Object.freeze({ access: 0.25, index: 0.15, entity: 0.20, content: 0.25, trust: 0.15 });
|
|
64
67
|
|
|
65
68
|
const ENGINES = [
|
|
66
|
-
{ id: 'chatgpt', label: 'ChatGPT', agents: ['oai-searchbot', 'chatgpt-user']
|
|
67
|
-
{ id: 'perplexity', label: 'Perplexity', agents: ['perplexitybot', 'perplexity-user']
|
|
68
|
-
{ id: 'claude', label: 'Claude', agents: ['claude-searchbot', 'claude-user']
|
|
69
|
-
{ id: 'gemini', label: 'Gemini', agents: ['google-extended']
|
|
70
|
-
{ id: 'copilot', label: 'Copilot', agents: ['bingbot']
|
|
69
|
+
{ id: 'chatgpt', label: 'ChatGPT', agents: ['oai-searchbot', 'chatgpt-user'] },
|
|
70
|
+
{ id: 'perplexity', label: 'Perplexity', agents: ['perplexitybot', 'perplexity-user'] },
|
|
71
|
+
{ id: 'claude', label: 'Claude', agents: ['claude-searchbot', 'claude-user'] },
|
|
72
|
+
{ id: 'gemini', label: 'Gemini', agents: ['google-extended'] },
|
|
73
|
+
{ id: 'copilot', label: 'Copilot', agents: ['bingbot'] },
|
|
71
74
|
];
|
|
72
75
|
|
|
73
76
|
/**
|
|
@@ -96,8 +99,7 @@ export const MESSAGES = {
|
|
|
96
99
|
rulesUnknown: ' Its robots.txt could not be read either, so there is nothing to say about AI crawlers: that is not counted for or against the site.',
|
|
97
100
|
howToCheckBots: ' To know for certain, open the server log and look for GPTBot, ClaudeBot and PerplexityBot, or ask whoever runs the protection which bots are on the allowlist.',
|
|
98
101
|
area: { access: 'Can AI crawlers read it', index: 'Is there a map for agents (llms.txt)', entity: 'Is the entity clear (schema)', content: 'Is there something to quote', trust: 'Can it be dated and trusted' },
|
|
99
|
-
|
|
100
|
-
engineIndex: 'answers from an index, so schema weighs more',
|
|
102
|
+
seo: { title: 'Title of 10 to 70 characters', description: 'Description of 50 to 170 characters', h1: 'An H1 on the page', canonical: 'A canonical address', og: 'An og:title for link previews', indexable: 'Not closed to indexing' },
|
|
101
103
|
llmsUnreadable: (status) => `The site did not let this check read llms.txt${status ? ` (HTTP ${status})` : ''}, so whether the site has a map for agents could not be measured. It is not counted for or against the site: a file we were refused is not the same as a file that is not there.`,
|
|
102
104
|
robotsMissing: 'There is no robots.txt on the site. By the standard that means nothing is disallowed, so every AI crawler may read it. A file is not required; add one only when something needs closing off.',
|
|
103
105
|
sampleShort: (read, wanted) => `Only ${read} of ${wanted} pages answered in time, twice in a row, so there was not enough of the site to score. We do not show a number here: a score that goes up because we read less is a score nobody can defend. The site may simply be slow right now; run the check again in a minute.`,
|
|
@@ -149,8 +151,7 @@ export const MESSAGES = {
|
|
|
149
151
|
rulesUnknown: ' Файл robots.txt прочитать тоже не вышло, поэтому про роботов ИИ сказать нечего, и в плюс или в минус сайту это не зачтено.',
|
|
150
152
|
howToCheckBots: ' Чтобы знать точно, посмотрите в журнале сервера, приходят ли GPTBot, ClaudeBot и PerplexityBot, либо спросите у тех, кто настраивал защиту, кто у неё в белом списке.',
|
|
151
153
|
area: { access: 'Могут ли роботы ИИ прочитать сайт', index: 'Есть ли карта для агентов (llms.txt)', entity: 'Понятно ли, кто вы (разметка)', content: 'Есть ли что процитировать', trust: 'Можно ли датировать и доверять' },
|
|
152
|
-
|
|
153
|
-
engineIndex: 'отвечает из индекса, поэтому разметка весит больше',
|
|
154
|
+
seo: { title: 'Заголовок от 10 до 70 знаков', description: 'Описание от 50 до 170 знаков', h1: 'На странице есть H1', canonical: 'Указан канонический адрес', og: 'Есть og:title для превью ссылки', indexable: 'Не закрыта от индексации' },
|
|
154
155
|
llmsUnreadable: (status) => `Сайт не дал этой проверке прочитать llms.txt${status ? ` (код ${status})` : ''}, поэтому есть ли у сайта карта для агентов, измерить не вышло. В плюс или в минус это не зачтено: файл, который нам не отдали, это не то же самое, что файла нет.`,
|
|
155
156
|
robotsMissing: 'Файла robots.txt на сайте нет. По стандарту это значит, что не запрещено ничего, то есть читать сайт может любой робот ИИ. Заводить файл необязательно: он нужен, только когда есть что закрывать.',
|
|
156
157
|
sampleShort: (read, wanted) => `Из ${wanted} страниц ответили ${read}, и со второй попытки тоже, поэтому считать балл не по чему. Числа здесь не будет: балл, который растёт оттого, что мы прочитали меньше, защитить нельзя. Возможно, сайт сейчас просто медленный: запустите проверку через минуту.`,
|
|
@@ -370,15 +371,16 @@ export function engineReadiness(verdicts, parts, T, label = (v) => v.label) {
|
|
|
370
371
|
const known = own.filter((v) => v.verdict !== 'unknown');
|
|
371
372
|
const share = {
|
|
372
373
|
// Доступ считается по роботам ЭТОГО движка, а не по всем четырнадцати: закрытый Applebot
|
|
373
|
-
// не мешает ChatGPT процитировать страницу.
|
|
374
|
+
// не мешает ChatGPT процитировать страницу. Это единственное, чем движки тут отличаются.
|
|
374
375
|
access: known.length ? known.filter((v) => v.verdict !== 'blocked').length / known.length : null,
|
|
376
|
+
index: parts.index,
|
|
375
377
|
entity: parts.entity,
|
|
376
378
|
content: parts.content,
|
|
377
379
|
trust: parts.trust,
|
|
378
380
|
};
|
|
379
381
|
let sum = 0;
|
|
380
382
|
let weight = 0;
|
|
381
|
-
for (const [key, w] of Object.entries(
|
|
383
|
+
for (const [key, w] of Object.entries(SCORE_MIX)) {
|
|
382
384
|
if (share[key] === null || share[key] === undefined) continue;
|
|
383
385
|
sum += share[key] * w;
|
|
384
386
|
weight += w;
|
|
@@ -386,7 +388,7 @@ export function engineReadiness(verdicts, parts, T, label = (v) => v.label) {
|
|
|
386
388
|
const score = weight ? Math.round((sum / weight) * 100) : null;
|
|
387
389
|
const blocked = own.filter((v) => v.verdict === 'blocked').map(label);
|
|
388
390
|
// Что тянет вниз: самая слабая из измеренных областей, кроме доступа, о нём сказано отдельно.
|
|
389
|
-
const areasByWeak = [['content', share.content], ['trust', share.trust], ['entity', share.entity]]
|
|
391
|
+
const areasByWeak = [['content', share.content], ['trust', share.trust], ['entity', share.entity], ['index', share.index]]
|
|
390
392
|
.filter(([, v]) => v !== null && v !== undefined)
|
|
391
393
|
.sort((a, b) => a[1] - b[1]);
|
|
392
394
|
const weakest = areasByWeak.length && areasByWeak[0][1] < 0.999 ? T.area[areasByWeak[0][0]] : null;
|
|
@@ -394,13 +396,45 @@ export function engineReadiness(verdicts, parts, T, label = (v) => v.label) {
|
|
|
394
396
|
id: e.id,
|
|
395
397
|
label: e.label,
|
|
396
398
|
score,
|
|
397
|
-
|
|
399
|
+
// Вместо рассуждений о природе движка говорим факт: чьи роботы спрошены.
|
|
400
|
+
how: own.map(label).join(', '),
|
|
398
401
|
blocked,
|
|
399
402
|
weakest,
|
|
400
403
|
};
|
|
401
404
|
});
|
|
402
405
|
}
|
|
403
406
|
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Основы SEO: второе число рядом с ИИ-видимостью.
|
|
410
|
+
*
|
|
411
|
+
* Простым языком. У большинства сайтов с обычным поиском всё в порядке, а для нейросетей они
|
|
412
|
+
* почти невидимы. Пока на экране одно число, этого разрыва не видно, и человек не понимает,
|
|
413
|
+
* почему ему вообще стоит волноваться. Два числа рядом объясняют это без слов: «для Google
|
|
414
|
+
* сайт в порядке, для ChatGPT нет».
|
|
415
|
+
*
|
|
416
|
+
* Считается ТОЛЬКО из того, что уже прочитано на тех же десяти страницах, ни одного нового
|
|
417
|
+
* запроса: заголовок, описание, H1, canonical, og:title и запрет индексации. Поэтому и
|
|
418
|
+
* называется «основы», а не «SEO»: полный аудит смотрит на скорость, ссылки и позиции, и этого
|
|
419
|
+
* здесь нет. Называть число громче, чем оно есть, это ровно то, за что мы критикуем конкурента.
|
|
420
|
+
*
|
|
421
|
+
* На балл ИИ-видимости не влияет ничем: это отдельное число, оно ни в плюс, ни в минус.
|
|
422
|
+
*/
|
|
423
|
+
export function seoBasics(pages, T) {
|
|
424
|
+
const rules = [
|
|
425
|
+
{ id: 'title', ok: (p) => p.title.length >= 10 && p.title.length <= 70 },
|
|
426
|
+
{ id: 'description', ok: (p) => p.description.length >= 50 && p.description.length <= 170 },
|
|
427
|
+
{ id: 'h1', ok: (p) => p.h1.length > 0 },
|
|
428
|
+
{ id: 'canonical', ok: (p) => p.canonical.length > 0 },
|
|
429
|
+
{ id: 'og', ok: (p) => p.ogTitle },
|
|
430
|
+
{ id: 'indexable', ok: (p) => !/noindex/.test(p.robotsMeta) },
|
|
431
|
+
];
|
|
432
|
+
const checks = rules.map((r) => ({ id: r.id, label: T.seo[r.id], passed: pages.filter(r.ok).length, total: pages.length }));
|
|
433
|
+
const passed = checks.reduce((a, c) => a + c.passed, 0);
|
|
434
|
+
const total = checks.reduce((a, c) => a + c.total, 0);
|
|
435
|
+
return { score: total ? Math.round((passed / total) * 100) : null, checks };
|
|
436
|
+
}
|
|
437
|
+
|
|
404
438
|
async function readSitemap(origin, robotsText, timeoutFn = () => 3000) {
|
|
405
439
|
const fromRobots = [...(robotsText || '').matchAll(/^sitemap:\s*(\S+)/gim)].map((m) => m[1]);
|
|
406
440
|
const candidates = fromRobots.length
|
|
@@ -815,8 +849,10 @@ export async function checkVisibility(input, { budgetMs = 8500, lang = 'en', sam
|
|
|
815
849
|
})),
|
|
816
850
|
sitemap: { found: sitemap.found, count: sitemap.count, lastmod: sitemap.lastmod, unchecked: Boolean(!sitemap.found && (sitemap.timedOut || sitemap.skipped)) },
|
|
817
851
|
crawlers: verdicts.map((v) => ({ label: agentLabel(v), kind: v.kind, verdict: v.verdict })),
|
|
852
|
+
seo: seoBasics(pages, T),
|
|
818
853
|
engines: engineReadiness(verdicts, {
|
|
819
854
|
access: null, // считается внутри по роботам каждого движка
|
|
855
|
+
index: llmsRead ? index / 15 : null,
|
|
820
856
|
entity: entity / 20,
|
|
821
857
|
content: sampleOk ? content / 25 : null,
|
|
822
858
|
trust: sampleOk ? trust / 15 : null,
|