@gotmar/audit 0.0.0-reserved → 0.1.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/LICENSE +21 -0
- package/README.md +12 -2
- package/dist/crawl.d.ts +28 -0
- package/dist/crawl.js +266 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +696 -0
- package/dist/launch.d.ts +22 -0
- package/dist/launch.js +150 -0
- package/dist/robots.d.ts +21 -0
- package/dist/robots.js +80 -0
- package/dist/types.d.ts +83 -0
- package/dist/types.js +1 -0
- package/package.json +37 -5
package/dist/launch.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Launch channels, shared by `gotmar launch` (writes launch/LAUNCH.md) and the dashboard's Launch section.
|
|
3
|
+
* Tracked links use utm_source=<channel domain>, which the Gotmar tracker maps to the readable source
|
|
4
|
+
* names listed in sourceNames, so the dashboard can tell which channels actually sent visitors.
|
|
5
|
+
*/
|
|
6
|
+
export interface LaunchChannel {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
/** Source names (as the tracker classifies visits) that count as this channel. */
|
|
10
|
+
sourceNames: string[];
|
|
11
|
+
/** Domain used as utm_source; null = don't tag (the referrer is enough, or tags are frowned upon). */
|
|
12
|
+
source: string | null;
|
|
13
|
+
url: string;
|
|
14
|
+
when: string;
|
|
15
|
+
fit: string;
|
|
16
|
+
copy: string;
|
|
17
|
+
aiOnly?: boolean;
|
|
18
|
+
devOnly?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const LAUNCH_CHANNELS: LaunchChannel[];
|
|
21
|
+
/** The link to post on a channel: utm_source=<channel domain> where tagging is welcome. */
|
|
22
|
+
export declare function trackedLink(siteUrl: string, source: string | null): string;
|
package/dist/launch.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Launch channels, shared by `gotmar launch` (writes launch/LAUNCH.md) and the dashboard's Launch section.
|
|
3
|
+
* Tracked links use utm_source=<channel domain>, which the Gotmar tracker maps to the readable source
|
|
4
|
+
* names listed in sourceNames, so the dashboard can tell which channels actually sent visitors.
|
|
5
|
+
*/
|
|
6
|
+
// Links point at each site's home or documented submit page; check the current rules before posting.
|
|
7
|
+
export const LAUNCH_CHANNELS = [
|
|
8
|
+
{
|
|
9
|
+
id: "show-hn",
|
|
10
|
+
name: "Show HN (Hacker News)",
|
|
11
|
+
sourceNames: ["Hacker News"],
|
|
12
|
+
source: null,
|
|
13
|
+
url: "https://news.ycombinator.com/showhn.html",
|
|
14
|
+
when: "Weekday morning US Eastern. Stay in the thread for the first 2-3 hours.",
|
|
15
|
+
fit: "Things people can try right away, built by you. Technical audiences.",
|
|
16
|
+
copy: "Title starting `Show HN:` (under 80 characters, no hype words) + a first comment: what it is, why you built it, how it works, what's next. Plain, honest, specific. Do not add tracking parameters to the URL.",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: "product-hunt",
|
|
20
|
+
name: "Product Hunt",
|
|
21
|
+
sourceNames: ["Product Hunt"],
|
|
22
|
+
source: "producthunt.com",
|
|
23
|
+
url: "https://www.producthunt.com/",
|
|
24
|
+
when: "Launches run midnight to midnight Pacific; prepare the listing a week ahead.",
|
|
25
|
+
fit: "Consumer and prosumer products, AI tools, dev tools.",
|
|
26
|
+
copy: "Tagline (60 characters), description (260 characters), maker's first comment (story + what feedback you want), 3-5 gallery image captions.",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: "indie-hackers",
|
|
30
|
+
name: "Indie Hackers",
|
|
31
|
+
sourceNames: ["Indie Hackers"],
|
|
32
|
+
source: "indiehackers.com",
|
|
33
|
+
url: "https://www.indiehackers.com/",
|
|
34
|
+
when: "Any time; post a build story rather than an ad.",
|
|
35
|
+
fit: "Solo founders, bootstrapped SaaS.",
|
|
36
|
+
copy: "A post titled with a lesson or number (e.g. 'I built X in 2 weeks with AI. Here's what worked'), 300-600 words, with the link once near the end.",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "reddit",
|
|
40
|
+
name: "Reddit",
|
|
41
|
+
sourceNames: ["Reddit"],
|
|
42
|
+
source: "reddit.com",
|
|
43
|
+
url: "https://www.reddit.com/r/SideProject/",
|
|
44
|
+
when: "Read each subreddit's rules first; many ban self-promotion outside set threads.",
|
|
45
|
+
fit: "r/SideProject and the subreddit where your users already ask for this.",
|
|
46
|
+
copy: "A genuinely useful post for the community (the problem, what you tried, what you built), not an ad. One subreddit at a time.",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "betalist",
|
|
50
|
+
name: "BetaList",
|
|
51
|
+
sourceNames: ["BetaList"],
|
|
52
|
+
source: "betalist.com",
|
|
53
|
+
url: "https://betalist.com/",
|
|
54
|
+
when: "Before or right after launch; there can be a queue.",
|
|
55
|
+
fit: "Early-stage startups looking for first users.",
|
|
56
|
+
copy: "One-line pitch + 2-3 sentence description + who it's for.",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "alternativeto",
|
|
60
|
+
name: "AlternativeTo",
|
|
61
|
+
sourceNames: ["AlternativeTo"],
|
|
62
|
+
source: "alternativeto.net",
|
|
63
|
+
url: "https://alternativeto.net/",
|
|
64
|
+
when: "Any time. List the product as an alternative to the 2-3 tools people compare you with.",
|
|
65
|
+
fit: "Anything that replaces a known product.",
|
|
66
|
+
copy: "Short description + the alternatives you list and why.",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "saashub",
|
|
70
|
+
name: "SaaSHub",
|
|
71
|
+
sourceNames: ["SaaSHub"],
|
|
72
|
+
source: "saashub.com",
|
|
73
|
+
url: "https://www.saashub.com/",
|
|
74
|
+
when: "Any time.",
|
|
75
|
+
fit: "SaaS products.",
|
|
76
|
+
copy: "Short and long description, category, competitors.",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: "uneed",
|
|
80
|
+
name: "Uneed",
|
|
81
|
+
sourceNames: ["Uneed"],
|
|
82
|
+
source: "uneed.best",
|
|
83
|
+
url: "https://www.uneed.best/",
|
|
84
|
+
when: "Daily launch board; pick a date.",
|
|
85
|
+
fit: "Tools and SaaS for makers.",
|
|
86
|
+
copy: "Tagline + description + 3 key features.",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: "peerlist",
|
|
90
|
+
name: "Peerlist Launchpad",
|
|
91
|
+
sourceNames: ["Peerlist"],
|
|
92
|
+
source: "peerlist.io",
|
|
93
|
+
url: "https://peerlist.io/",
|
|
94
|
+
when: "Weekly launchpad.",
|
|
95
|
+
fit: "Products built by developers and designers.",
|
|
96
|
+
copy: "Tagline + description + what's new.",
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "devhunt",
|
|
100
|
+
name: "DevHunt",
|
|
101
|
+
sourceNames: ["DevHunt"],
|
|
102
|
+
source: "devhunt.org",
|
|
103
|
+
url: "https://devhunt.org/",
|
|
104
|
+
when: "Weekly.",
|
|
105
|
+
fit: "Developer tools only.",
|
|
106
|
+
copy: "Tagline + description.",
|
|
107
|
+
devOnly: true,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: "taaft",
|
|
111
|
+
name: "There's An AI For That",
|
|
112
|
+
sourceNames: ["There's An AI For That"],
|
|
113
|
+
source: "theresanaiforthat.com",
|
|
114
|
+
url: "https://theresanaiforthat.com/",
|
|
115
|
+
when: "Any time.",
|
|
116
|
+
fit: "AI-powered products only.",
|
|
117
|
+
copy: "Task the AI does (e.g. 'Invoice reminders'), short description.",
|
|
118
|
+
aiOnly: true,
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: "futurepedia",
|
|
122
|
+
name: "Futurepedia",
|
|
123
|
+
sourceNames: ["Futurepedia"],
|
|
124
|
+
source: "futurepedia.io",
|
|
125
|
+
url: "https://www.futurepedia.io/",
|
|
126
|
+
when: "Any time.",
|
|
127
|
+
fit: "AI-powered products only.",
|
|
128
|
+
copy: "Short description, category, pricing model.",
|
|
129
|
+
aiOnly: true,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: "own-posts",
|
|
133
|
+
name: "Your own posts (X, LinkedIn, Bluesky, Threads)",
|
|
134
|
+
sourceNames: ["X", "LinkedIn", "Bluesky", "Threads", "Facebook"],
|
|
135
|
+
source: null,
|
|
136
|
+
url: "",
|
|
137
|
+
when: "Launch day, then a follow-up a week later with what you learned.",
|
|
138
|
+
fit: "Your network. The referrer shows which network sent each visit.",
|
|
139
|
+
copy: "One launch post per network, written for how people talk there (short on X/Bluesky, a story on LinkedIn). Include a screenshot or 20-second video.",
|
|
140
|
+
},
|
|
141
|
+
];
|
|
142
|
+
/** The link to post on a channel: utm_source=<channel domain> where tagging is welcome. */
|
|
143
|
+
export function trackedLink(siteUrl, source) {
|
|
144
|
+
if (!source)
|
|
145
|
+
return siteUrl;
|
|
146
|
+
const u = new URL(siteUrl);
|
|
147
|
+
u.searchParams.set("utm_source", source);
|
|
148
|
+
u.searchParams.set("utm_medium", "launch");
|
|
149
|
+
return u.toString();
|
|
150
|
+
}
|
package/dist/robots.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal robots.txt parser following RFC 9309 semantics:
|
|
3
|
+
* - groups are matched by product token (case-insensitive)
|
|
4
|
+
* - if no specific group matches, the "*" group applies
|
|
5
|
+
* - the longest matching rule wins; on a tie, Allow wins
|
|
6
|
+
* - "*" wildcards and "$" end anchors are supported in paths
|
|
7
|
+
*/
|
|
8
|
+
export interface RobotsRule {
|
|
9
|
+
allow: boolean;
|
|
10
|
+
path: string;
|
|
11
|
+
}
|
|
12
|
+
export interface RobotsGroup {
|
|
13
|
+
agents: string[];
|
|
14
|
+
rules: RobotsRule[];
|
|
15
|
+
}
|
|
16
|
+
export interface ParsedRobots {
|
|
17
|
+
groups: RobotsGroup[];
|
|
18
|
+
sitemaps: string[];
|
|
19
|
+
}
|
|
20
|
+
export declare function parseRobots(text: string): ParsedRobots;
|
|
21
|
+
export declare function isAllowed(robots: ParsedRobots, token: string, path?: string): boolean;
|
package/dist/robots.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal robots.txt parser following RFC 9309 semantics:
|
|
3
|
+
* - groups are matched by product token (case-insensitive)
|
|
4
|
+
* - if no specific group matches, the "*" group applies
|
|
5
|
+
* - the longest matching rule wins; on a tie, Allow wins
|
|
6
|
+
* - "*" wildcards and "$" end anchors are supported in paths
|
|
7
|
+
*/
|
|
8
|
+
export function parseRobots(text) {
|
|
9
|
+
const groups = [];
|
|
10
|
+
const sitemaps = [];
|
|
11
|
+
let current = null;
|
|
12
|
+
let lastWasAgent = false;
|
|
13
|
+
for (const rawLine of text.split(/\r?\n/)) {
|
|
14
|
+
const line = rawLine.replace(/#.*$/, "").trim();
|
|
15
|
+
if (!line)
|
|
16
|
+
continue;
|
|
17
|
+
const idx = line.indexOf(":");
|
|
18
|
+
if (idx === -1)
|
|
19
|
+
continue;
|
|
20
|
+
const field = line.slice(0, idx).trim().toLowerCase();
|
|
21
|
+
const value = line.slice(idx + 1).trim();
|
|
22
|
+
if (field === "user-agent") {
|
|
23
|
+
if (!current || !lastWasAgent) {
|
|
24
|
+
current = { agents: [], rules: [] };
|
|
25
|
+
groups.push(current);
|
|
26
|
+
}
|
|
27
|
+
current.agents.push(value.toLowerCase());
|
|
28
|
+
lastWasAgent = true;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
lastWasAgent = false;
|
|
32
|
+
if (field === "sitemap") {
|
|
33
|
+
if (value)
|
|
34
|
+
sitemaps.push(value);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (!current)
|
|
38
|
+
continue;
|
|
39
|
+
if (field === "allow" || field === "disallow") {
|
|
40
|
+
// An empty Disallow means "allow everything" and adds no rule.
|
|
41
|
+
if (value === "" && field === "disallow")
|
|
42
|
+
continue;
|
|
43
|
+
current.rules.push({ allow: field === "allow", path: value });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { groups, sitemaps };
|
|
47
|
+
}
|
|
48
|
+
function ruleMatches(rulePath, path) {
|
|
49
|
+
if (rulePath === "")
|
|
50
|
+
return false;
|
|
51
|
+
const anchored = rulePath.endsWith("$");
|
|
52
|
+
const body = anchored ? rulePath.slice(0, -1) : rulePath;
|
|
53
|
+
const pattern = body
|
|
54
|
+
.split("*")
|
|
55
|
+
.map((part) => part.replace(/[.+?^${}()|[\]\\]/g, "\\$&"))
|
|
56
|
+
.join(".*");
|
|
57
|
+
return new RegExp("^" + pattern + (anchored ? "$" : "")).test(path);
|
|
58
|
+
}
|
|
59
|
+
/** Returns the groups that apply to a given crawler product token. */
|
|
60
|
+
function groupsFor(robots, token) {
|
|
61
|
+
const t = token.toLowerCase();
|
|
62
|
+
const specific = robots.groups.filter((g) => g.agents.some((a) => a !== "*" && a === t));
|
|
63
|
+
if (specific.length)
|
|
64
|
+
return specific;
|
|
65
|
+
return robots.groups.filter((g) => g.agents.includes("*"));
|
|
66
|
+
}
|
|
67
|
+
export function isAllowed(robots, token, path = "/") {
|
|
68
|
+
const rules = groupsFor(robots, token).flatMap((g) => g.rules);
|
|
69
|
+
let best = null;
|
|
70
|
+
for (const rule of rules) {
|
|
71
|
+
if (!ruleMatches(rule.path, path))
|
|
72
|
+
continue;
|
|
73
|
+
if (!best ||
|
|
74
|
+
rule.path.length > best.path.length ||
|
|
75
|
+
(rule.path.length === best.path.length && rule.allow && !best.allow)) {
|
|
76
|
+
best = rule;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return best ? best.allow : true;
|
|
80
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export type Severity = "critical" | "warning" | "info";
|
|
2
|
+
export type Category = "indexing" | "on-page" | "social" | "ai-search" | "performance";
|
|
3
|
+
export interface AuditIssue {
|
|
4
|
+
id: string;
|
|
5
|
+
severity: Severity;
|
|
6
|
+
category: Category;
|
|
7
|
+
title: string;
|
|
8
|
+
/** What we found, in plain English. */
|
|
9
|
+
detail: string;
|
|
10
|
+
/** An instruction a coding agent can follow to fix it. */
|
|
11
|
+
fix: string;
|
|
12
|
+
/** Set when only the human can do this (e.g. sign in to Google). */
|
|
13
|
+
humanStep?: {
|
|
14
|
+
label: string;
|
|
15
|
+
url: string;
|
|
16
|
+
};
|
|
17
|
+
/** For site-wide checks: the affected paths (e.g. "/pricing"), so runs can be compared. */
|
|
18
|
+
urls?: string[];
|
|
19
|
+
}
|
|
20
|
+
export interface AuditPass {
|
|
21
|
+
id: string;
|
|
22
|
+
category: Category;
|
|
23
|
+
title: string;
|
|
24
|
+
}
|
|
25
|
+
export interface AuditFacts {
|
|
26
|
+
title: string | null;
|
|
27
|
+
description: string | null;
|
|
28
|
+
canonical: string | null;
|
|
29
|
+
lang: string | null;
|
|
30
|
+
h1: string[];
|
|
31
|
+
wordCount: number;
|
|
32
|
+
jsonLdTypes: string[];
|
|
33
|
+
ogImage: string | null;
|
|
34
|
+
imagesTotal: number;
|
|
35
|
+
imagesMissingAlt: number;
|
|
36
|
+
googleVerification: boolean;
|
|
37
|
+
bingVerification: boolean;
|
|
38
|
+
robotsTxt: {
|
|
39
|
+
found: boolean;
|
|
40
|
+
sitemaps: string[];
|
|
41
|
+
blocked: Record<string, boolean>;
|
|
42
|
+
};
|
|
43
|
+
sitemap: {
|
|
44
|
+
found: boolean;
|
|
45
|
+
url: string | null;
|
|
46
|
+
urlCount: number;
|
|
47
|
+
};
|
|
48
|
+
llmsTxt: {
|
|
49
|
+
found: boolean;
|
|
50
|
+
bytes: number;
|
|
51
|
+
};
|
|
52
|
+
/** Pages fetched by the whole-site crawl (0 when the crawl was not requested). */
|
|
53
|
+
pagesCrawled: number;
|
|
54
|
+
}
|
|
55
|
+
export interface AuditReport {
|
|
56
|
+
url: string;
|
|
57
|
+
finalUrl: string;
|
|
58
|
+
fetchedAt: string;
|
|
59
|
+
status: number;
|
|
60
|
+
responseMs: number;
|
|
61
|
+
score: number;
|
|
62
|
+
grade: "A" | "B" | "C" | "D" | "F";
|
|
63
|
+
issues: AuditIssue[];
|
|
64
|
+
passed: AuditPass[];
|
|
65
|
+
facts: AuditFacts | null;
|
|
66
|
+
}
|
|
67
|
+
export interface AuditOptions {
|
|
68
|
+
/** Request timeout per fetch, in ms. Default 15000. */
|
|
69
|
+
timeoutMs?: number;
|
|
70
|
+
/** User-Agent used for fetches. Default identifies Gotmar. */
|
|
71
|
+
userAgent?: string;
|
|
72
|
+
/** Custom fetch (for tests or SSRF-guarded fetch in the hosted app). */
|
|
73
|
+
fetch?: typeof fetch;
|
|
74
|
+
/** Extra request headers, e.g. { "x-vercel-protection-bypass": secret } for protected previews. */
|
|
75
|
+
headers?: Record<string, string>;
|
|
76
|
+
/**
|
|
77
|
+
* Auditing a preview deployment: ignore the X-Robots-Tag: noindex header hosts add to previews,
|
|
78
|
+
* and don't flag canonical/sitemap URLs that point at the production domain.
|
|
79
|
+
*/
|
|
80
|
+
preview?: boolean;
|
|
81
|
+
/** Also crawl up to this many sitemap pages (and their internal links). Default 0 = homepage only. */
|
|
82
|
+
maxPages?: number;
|
|
83
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,8 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gotmar/audit",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Gotmar SEO
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Gotmar SEO + AI-search (AEO) audit engine. Sees a page the way crawlers do: raw HTML, no JavaScript.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"gotmar",
|
|
7
|
+
"seo",
|
|
8
|
+
"aeo",
|
|
9
|
+
"audit",
|
|
10
|
+
"crawler",
|
|
11
|
+
"ai-search"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://getgotmar.com/docs",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc -p tsconfig.json",
|
|
28
|
+
"prepublishOnly": "npm run build"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"node-html-parser": "^9.0.10"
|
|
32
|
+
},
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=18.17"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
}
|
|
8
40
|
}
|