aeo-ready 1.1.0 → 1.2.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/bin/cli.js +9 -62
- package/package.json +2 -2
- package/src/dashboard/generate.js +22 -48
- package/src/dashboard/sections/benchmark-details.js +79 -0
- package/src/dashboard/sections/history-table.js +10 -7
- package/src/dashboard/sections/overall-score.js +55 -118
- package/src/dashboard/sections/trend-chart.js +31 -46
- package/src/history/index.js +8 -15
- package/src/scan.js +59 -293
- package/src/checks/agent-readiness/actionable.js +0 -165
- package/src/checks/agent-readiness/capability.js +0 -209
- package/src/checks/agent-readiness/content-structure.js +0 -242
- package/src/checks/agent-readiness/discovery.js +0 -231
- package/src/checks/ai-visibility/authority.js +0 -195
- package/src/checks/ai-visibility/citation-readiness.js +0 -228
- package/src/checks/ai-visibility/freshness.js +0 -182
- package/src/checks/ai-visibility/structured-data.js +0 -180
- package/src/dashboard/sections/agent-readiness.js +0 -71
- package/src/dashboard/sections/ai-visibility.js +0 -67
- package/src/dashboard/sections/recommendations.js +0 -196
- package/src/fix/generators/agents-json.js +0 -73
- package/src/fix/generators/agents-md.js +0 -85
- package/src/fix/generators/llms-txt.js +0 -166
- package/src/fix/generators/robots-txt.js +0 -64
- package/src/fix/index.js +0 -177
- package/src/track/index.js +0 -167
- package/src/utils/detect-type.js +0 -99
- package/src/utils/tokens.js +0 -18
package/src/track/index.js
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
|
|
3
|
-
const PROVIDERS = {
|
|
4
|
-
claude: {
|
|
5
|
-
name: "Claude",
|
|
6
|
-
url: "https://api.anthropic.com/v1/messages",
|
|
7
|
-
envKey: "ANTHROPIC_API_KEY",
|
|
8
|
-
model: "claude-sonnet-4-6",
|
|
9
|
-
call: callClaude,
|
|
10
|
-
},
|
|
11
|
-
openai: {
|
|
12
|
-
name: "ChatGPT",
|
|
13
|
-
url: "https://api.openai.com/v1/chat/completions",
|
|
14
|
-
envKey: "OPENAI_API_KEY",
|
|
15
|
-
model: "gpt-4o-mini",
|
|
16
|
-
call: callOpenAI,
|
|
17
|
-
},
|
|
18
|
-
google: {
|
|
19
|
-
name: "Gemini",
|
|
20
|
-
envKey: "GOOGLE_API_KEY",
|
|
21
|
-
model: "gemini-2.0-flash",
|
|
22
|
-
call: callGoogle,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const DEFAULT_PROMPTS = [
|
|
27
|
-
{ template: "What is {company}?", category: "brand" },
|
|
28
|
-
{ template: "What does {company} do?", category: "brand" },
|
|
29
|
-
{ template: "Best {category} tools?", category: "discovery" },
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
export async function track(scanResult, config) {
|
|
33
|
-
const company = config.company || inferCompany(scanResult);
|
|
34
|
-
const category = config.category || "";
|
|
35
|
-
const prompts = config.prompts || DEFAULT_PROMPTS;
|
|
36
|
-
|
|
37
|
-
const available = getAvailableProviders();
|
|
38
|
-
if (available.length === 0) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const rendered = prompts.map((p) => ({
|
|
43
|
-
...p,
|
|
44
|
-
text: p.template
|
|
45
|
-
.replace("{company}", company)
|
|
46
|
-
.replace("{category}", category),
|
|
47
|
-
}));
|
|
48
|
-
|
|
49
|
-
const results = [];
|
|
50
|
-
|
|
51
|
-
for (const prompt of rendered) {
|
|
52
|
-
for (const provider of available) {
|
|
53
|
-
try {
|
|
54
|
-
const response = await provider.call(prompt.text, provider.model);
|
|
55
|
-
results.push({
|
|
56
|
-
provider: provider.name,
|
|
57
|
-
prompt: prompt.text,
|
|
58
|
-
category: prompt.category,
|
|
59
|
-
response: response.slice(0, 500),
|
|
60
|
-
mentions: response.toLowerCase().includes(company.toLowerCase()),
|
|
61
|
-
});
|
|
62
|
-
} catch {
|
|
63
|
-
results.push({
|
|
64
|
-
provider: provider.name,
|
|
65
|
-
prompt: prompt.text,
|
|
66
|
-
category: prompt.category,
|
|
67
|
-
response: "(failed)",
|
|
68
|
-
mentions: false,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return results;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function printTrackResults(results, company) {
|
|
78
|
-
if (!results || results.length === 0) return;
|
|
79
|
-
|
|
80
|
-
console.log(chalk.bold("\n AI Visibility — what models say about you\n"));
|
|
81
|
-
|
|
82
|
-
const grouped = {};
|
|
83
|
-
for (const r of results) {
|
|
84
|
-
if (!grouped[r.prompt]) grouped[r.prompt] = [];
|
|
85
|
-
grouped[r.prompt].push(r);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
for (const [prompt, responses] of Object.entries(grouped)) {
|
|
89
|
-
console.log(chalk.dim(` > "${prompt}"\n`));
|
|
90
|
-
for (const r of responses) {
|
|
91
|
-
const icon = r.mentions ? chalk.green("cited") : chalk.red("not cited");
|
|
92
|
-
console.log(` ${chalk.bold(r.provider)} [${icon}]`);
|
|
93
|
-
const lines = r.response.split("\n").slice(0, 3);
|
|
94
|
-
for (const line of lines) {
|
|
95
|
-
console.log(chalk.dim(` ${line.slice(0, 80)}`));
|
|
96
|
-
}
|
|
97
|
-
console.log("");
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const total = results.length;
|
|
102
|
-
const cited = results.filter((r) => r.mentions).length;
|
|
103
|
-
const rate = Math.round((cited / total) * 100);
|
|
104
|
-
console.log(chalk.bold(` Citation rate: ${cited}/${total} (${rate}%)\n`));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export function getAvailableProviders() {
|
|
108
|
-
return Object.values(PROVIDERS).filter((p) => process.env[p.envKey]);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function inferCompany(scanResult) {
|
|
112
|
-
const target = scanResult.target || "";
|
|
113
|
-
try {
|
|
114
|
-
return new URL(target).hostname.replace("www.", "").split(".")[0];
|
|
115
|
-
} catch {
|
|
116
|
-
return target.split("/").pop() || "unknown";
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
async function callClaude(prompt, model) {
|
|
121
|
-
const res = await fetch("https://api.anthropic.com/v1/messages", {
|
|
122
|
-
method: "POST",
|
|
123
|
-
headers: {
|
|
124
|
-
"x-api-key": process.env.ANTHROPIC_API_KEY,
|
|
125
|
-
"anthropic-version": "2023-06-01",
|
|
126
|
-
"content-type": "application/json",
|
|
127
|
-
},
|
|
128
|
-
body: JSON.stringify({
|
|
129
|
-
model,
|
|
130
|
-
max_tokens: 300,
|
|
131
|
-
messages: [{ role: "user", content: prompt }],
|
|
132
|
-
}),
|
|
133
|
-
});
|
|
134
|
-
const data = await res.json();
|
|
135
|
-
return data.content?.[0]?.text || "";
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
async function callOpenAI(prompt, model) {
|
|
139
|
-
const res = await fetch("https://api.openai.com/v1/chat/completions", {
|
|
140
|
-
method: "POST",
|
|
141
|
-
headers: {
|
|
142
|
-
Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
|
|
143
|
-
"content-type": "application/json",
|
|
144
|
-
},
|
|
145
|
-
body: JSON.stringify({
|
|
146
|
-
model,
|
|
147
|
-
messages: [{ role: "user", content: prompt }],
|
|
148
|
-
max_tokens: 300,
|
|
149
|
-
}),
|
|
150
|
-
});
|
|
151
|
-
const data = await res.json();
|
|
152
|
-
return data.choices?.[0]?.message?.content || "";
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
async function callGoogle(prompt, model) {
|
|
156
|
-
const key = process.env.GOOGLE_API_KEY;
|
|
157
|
-
const res = await fetch(
|
|
158
|
-
`https://generativelanguage.googleapis.com/v1beta/models/${model}:generateContent?key=${key}`,
|
|
159
|
-
{
|
|
160
|
-
method: "POST",
|
|
161
|
-
headers: { "content-type": "application/json" },
|
|
162
|
-
body: JSON.stringify({ contents: [{ parts: [{ text: prompt }] }] }),
|
|
163
|
-
},
|
|
164
|
-
);
|
|
165
|
-
const data = await res.json();
|
|
166
|
-
return data.candidates?.[0]?.content?.parts?.[0]?.text || "";
|
|
167
|
-
}
|
package/src/utils/detect-type.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
export function detectSiteType(signals) {
|
|
2
|
-
const { html, files, url } = signals;
|
|
3
|
-
const text = (html || "").toLowerCase();
|
|
4
|
-
const fileList = (files || []).map((f) => f.toLowerCase());
|
|
5
|
-
|
|
6
|
-
const scores = {
|
|
7
|
-
saas: scoreSaas(text, fileList, url),
|
|
8
|
-
api: scoreApi(text, fileList, url),
|
|
9
|
-
content: scoreContent(text, fileList, url),
|
|
10
|
-
personal: scorePersonal(text, fileList, url),
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const sorted = Object.entries(scores).sort((a, b) => b[1] - a[1]);
|
|
14
|
-
if (sorted[0][1] === 0) return "unknown";
|
|
15
|
-
return sorted[0][0];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function scoreSaas(text, files, url) {
|
|
19
|
-
let score = 0;
|
|
20
|
-
if (text.includes("/pricing") || text.includes("/plans")) score += 3;
|
|
21
|
-
if (text.includes("pricing") && !text.includes("/pricing")) score += 1;
|
|
22
|
-
if (text.includes("sign up") || text.includes("signup")) score += 2;
|
|
23
|
-
if (text.includes("free trial") || text.includes("start free")) score += 2;
|
|
24
|
-
if (text.includes("dashboard") && text.includes("login")) score += 2;
|
|
25
|
-
if (text.includes("per month") || text.includes("/mo")) score += 2;
|
|
26
|
-
if (files.some((f) => f.includes("pricing"))) score += 2;
|
|
27
|
-
return score;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function scoreApi(text, files, url) {
|
|
31
|
-
let score = 0;
|
|
32
|
-
const hostname = extractHostname(url);
|
|
33
|
-
if (
|
|
34
|
-
hostname &&
|
|
35
|
-
(hostname.startsWith("docs.") || hostname.startsWith("developer."))
|
|
36
|
-
)
|
|
37
|
-
score += 4;
|
|
38
|
-
if (text.includes("api reference") || text.includes("api docs")) score += 3;
|
|
39
|
-
if (text.includes("sdk") || text.includes("client library")) score += 2;
|
|
40
|
-
if (text.includes("openapi") || text.includes("swagger")) score += 3;
|
|
41
|
-
if (text.includes("endpoint") || text.includes("authentication")) score += 1;
|
|
42
|
-
if (text.includes("npm install") || text.includes("pip install")) score += 2;
|
|
43
|
-
if (files.some((f) => f.includes("openapi") || f.includes("swagger")))
|
|
44
|
-
score += 3;
|
|
45
|
-
if (files.some((f) => f.includes("sdk") || f.includes("client"))) score += 1;
|
|
46
|
-
return score;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function scoreContent(text, files, url) {
|
|
50
|
-
let score = 0;
|
|
51
|
-
if (text.includes("/blog") || text.includes("blog")) score += 2;
|
|
52
|
-
if ((text.match(/article/g) || []).length >= 3) score += 2;
|
|
53
|
-
if (text.includes("published") && text.includes("author")) score += 2;
|
|
54
|
-
if (text.includes("read more") || text.includes("continue reading"))
|
|
55
|
-
score += 2;
|
|
56
|
-
if (text.includes("subscribe") && text.includes("newsletter")) score += 1;
|
|
57
|
-
if (files.some((f) => f.includes("blog") || f.includes("posts"))) score += 3;
|
|
58
|
-
if (files.filter((f) => f.endsWith(".md")).length > 10) score += 1;
|
|
59
|
-
return score;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function scorePersonal(text, files, url) {
|
|
63
|
-
let score = 0;
|
|
64
|
-
const hostname = extractHostname(url);
|
|
65
|
-
if (hostname && isPersonalDomain(hostname)) score += 3;
|
|
66
|
-
if (text.includes("portfolio") || text.includes("my work")) score += 3;
|
|
67
|
-
if (
|
|
68
|
-
text.includes("about me") ||
|
|
69
|
-
text.includes("i am") ||
|
|
70
|
-
text.includes("i'm a")
|
|
71
|
-
)
|
|
72
|
-
score += 3;
|
|
73
|
-
if (text.includes("resume") || text.includes("cv")) score += 2;
|
|
74
|
-
if (text.includes("hire me") || text.includes("available for")) score += 2;
|
|
75
|
-
if (text.includes("linkedin.com/in/") || text.includes("github.com/"))
|
|
76
|
-
score += 1;
|
|
77
|
-
if (text.includes("@") && text.includes("contact")) score += 1;
|
|
78
|
-
return score;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function extractHostname(url) {
|
|
82
|
-
if (!url) return null;
|
|
83
|
-
try {
|
|
84
|
-
return new URL(url).hostname.replace("www.", "");
|
|
85
|
-
} catch {
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function isPersonalDomain(hostname) {
|
|
91
|
-
const parts = hostname.split(".");
|
|
92
|
-
const name = parts[0];
|
|
93
|
-
const tld = parts.slice(1).join(".");
|
|
94
|
-
const personalTlds = ["com", "me", "io", "dev", "co", "net", "org"];
|
|
95
|
-
if (!personalTlds.includes(tld)) return false;
|
|
96
|
-
return /^[a-z]+[a-z]+$/.test(name) && name.length >= 6 && name.length <= 20;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export const SITE_TYPES = ["saas", "api", "content", "personal", "unknown"];
|
package/src/utils/tokens.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export function estimateTokens(text) {
|
|
2
|
-
if (!text) return 0;
|
|
3
|
-
return Math.ceil(text.length / 4);
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export const TOKEN_BUDGETS = {
|
|
7
|
-
quickstart: 15000,
|
|
8
|
-
apiRef: 25000,
|
|
9
|
-
guide: 20000,
|
|
10
|
-
llmsTxt: 5000,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export function checkTokenBudget(text, type) {
|
|
14
|
-
const tokens = estimateTokens(text);
|
|
15
|
-
const budget = TOKEN_BUDGETS[type];
|
|
16
|
-
if (!budget) return { tokens, withinBudget: true, budget: null };
|
|
17
|
-
return { tokens, withinBudget: tokens <= budget, budget };
|
|
18
|
-
}
|