crawlemon 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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Crawlemon Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,375 @@
1
+ # Crawlemon
2
+
3
+ **Deterministic SEO checks for Next.js projects.**
4
+
5
+ Crawlemon is a developer-first SEO audit and safe-fix CLI. It works like a lightweight ESLint for SEO: run it inside a Next.js repository, find issues before they reach production, and automatically repair changes that are deterministic and safe.
6
+
7
+ No account, cloud connection, browser, AI provider, or API key is required.
8
+
9
+ ## Quick start
10
+
11
+ Run an audit from the root of a Next.js project:
12
+
13
+ ```bash
14
+ npx crawlemon audit
15
+ ```
16
+
17
+ Preview safe automatic fixes without changing files:
18
+
19
+ ```bash
20
+ npx crawlemon fix --dry-run
21
+ ```
22
+
23
+ Apply the available safe fixes:
24
+
25
+ ```bash
26
+ npx crawlemon fix
27
+ ```
28
+
29
+ ## Requirements
30
+
31
+ - Node.js 20 or newer
32
+ - A Next.js project using the App Router or Pages Router
33
+ - Run the command from the project root
34
+
35
+ Crawlemon uses static source analysis. It does not run your application, install its dependencies, or execute repository scripts.
36
+
37
+ ## Commands
38
+
39
+ ### `audit`
40
+
41
+ Discover routes and run deterministic SEO checks:
42
+
43
+ ```bash
44
+ npx crawlemon audit
45
+ ```
46
+
47
+ The report includes:
48
+
49
+ - Overall SEO score from 0 to 100
50
+ - Technical, metadata, content, and internal-link scores
51
+ - Errors, warnings, and informational findings
52
+ - Route and source-file locations
53
+ - Safe-fix availability
54
+
55
+ Example:
56
+
57
+ ```text
58
+ Crawlemon Audit (8 routes scanned)
59
+
60
+ SEO Score: 69/100
61
+ Technical: 51
62
+ Metadata: 79
63
+ Content: 85
64
+ Internal Links: 70
65
+
66
+ 13 errors, 2 warnings
67
+ 11 safe fixes available
68
+ ```
69
+
70
+ When the `CI` environment variable is set, `audit` exits with status code `1` if an error-level finding is present. This allows the command to act as a CI quality gate.
71
+
72
+ ```bash
73
+ CI=true npx crawlemon audit
74
+ ```
75
+
76
+ ### `fix`
77
+
78
+ Apply deterministic fixes:
79
+
80
+ ```bash
81
+ npx crawlemon fix
82
+ ```
83
+
84
+ Every changed file is shown as a diff. Crawlemon may:
85
+
86
+ - Create `robots.txt` or `app/robots.ts`
87
+ - Create or repair a sitemap when `siteUrl` is known
88
+ - Add canonical metadata when the site URL and route are unambiguous
89
+ - Repair internal-link casing when exactly one existing route matches
90
+
91
+ Crawlemon will not automatically:
92
+
93
+ - Rewrite marketing copy
94
+ - Invent titles, descriptions, keywords, or image alt text
95
+ - Change the meaning of page content
96
+ - Delete user content
97
+ - Execute project code
98
+
99
+ ### `fix --dry-run`
100
+
101
+ Generate the same proposed changes and diffs without writing to disk:
102
+
103
+ ```bash
104
+ npx crawlemon fix --dry-run
105
+ ```
106
+
107
+ Use this command before applying fixes in an unfamiliar repository or as part of a review workflow.
108
+
109
+ ### `links`
110
+
111
+ Inspect the internal-link graph:
112
+
113
+ ```bash
114
+ npx crawlemon links
115
+ ```
116
+
117
+ The report includes:
118
+
119
+ - Discovered routes and internal edges
120
+ - Broken internal links
121
+ - Orphan pages with no incoming links
122
+ - Dead-end and low-connectivity pages
123
+ - Explainable internal-link recommendations
124
+
125
+ Recommendations use deterministic signals such as route slugs, titles, headings, and token overlap. They do not require embeddings or an AI model.
126
+
127
+ ### `opportunities`
128
+
129
+ Find potential content expansions from existing route patterns:
130
+
131
+ ```bash
132
+ npx crawlemon opportunities
133
+ ```
134
+
135
+ For example, these routes:
136
+
137
+ ```text
138
+ /invoice/freelancer
139
+ /invoice/agency
140
+ /invoice/consultant
141
+ ```
142
+
143
+ produce an `/invoice/{topic}` cluster with a small, bounded list of possible additions. Crawlemon only recommends opportunities; it never creates or publishes pages automatically.
144
+
145
+ ### Help and version
146
+
147
+ ```bash
148
+ npx crawlemon --help
149
+ npx crawlemon --version
150
+ ```
151
+
152
+ ## Zero-configuration detection
153
+
154
+ Crawlemon automatically detects:
155
+
156
+ - Next.js projects
157
+ - App Router and Pages Router
158
+ - Root-level and `src/` router directories
159
+ - Static route structure
160
+ - Route groups
161
+ - Page metadata declarations
162
+ - Titles and meta descriptions
163
+ - Canonical URLs
164
+ - Headings, images, and internal links
165
+ - `robots.txt`, `app/robots.ts`, sitemap XML, and `app/sitemap.ts`
166
+ - Static redirects declared in common `next.config` formats
167
+ - Common JSON-LD structures
168
+
169
+ Dynamic routes are discovered and audited, but they are excluded from generated sitemap entries because their final URLs cannot be inferred safely from source alone.
170
+
171
+ ## Configuration
172
+
173
+ Configuration is optional. Create `seo.config.ts` in the project root when you need to provide a site URL, ignore routes, or change rule behavior.
174
+
175
+ ```ts
176
+ export default {
177
+ siteUrl: "https://example.com",
178
+ ignore: ["/admin/**", "/api/**"],
179
+ rules: {
180
+ requireCanonical: true,
181
+ requireDescription: true,
182
+ },
183
+ };
184
+ ```
185
+
186
+ JavaScript and JSON configuration files are also supported:
187
+
188
+ ```text
189
+ seo.config.ts
190
+ seo.config.js
191
+ seo.config.json
192
+ ```
193
+
194
+ ### `siteUrl`
195
+
196
+ The absolute production origin for canonical and sitemap generation:
197
+
198
+ ```ts
199
+ siteUrl: "https://example.com"
200
+ ```
201
+
202
+ Crawlemon does not generate placeholder production URLs. Sitemap and canonical fixes that require an origin remain unavailable until a valid HTTP or HTTPS `siteUrl` is configured.
203
+
204
+ ### `ignore`
205
+
206
+ Exclude private or non-indexable route patterns:
207
+
208
+ ```ts
209
+ ignore: ["/admin/**", "/api/**", "/preview/*"]
210
+ ```
211
+
212
+ ### `rules`
213
+
214
+ Disable an individual rule:
215
+
216
+ ```ts
217
+ rules: {
218
+ images: false,
219
+ requireCanonical: false,
220
+ }
221
+ ```
222
+
223
+ Supported rule identifiers include:
224
+
225
+ ```text
226
+ metadata-title
227
+ metadata-description
228
+ metadata-conflicts
229
+ canonical
230
+ headings
231
+ images
232
+ links
233
+ crawlability
234
+ structured-data
235
+ routes
236
+ redirects
237
+ ```
238
+
239
+ ## What Crawlemon checks
240
+
241
+ ### Metadata
242
+
243
+ - Missing or empty titles
244
+ - Suspiciously short or long titles
245
+ - Duplicate titles
246
+ - Missing and duplicate meta descriptions
247
+ - Missing, malformed, duplicated, or unexpected canonical URLs
248
+ - Conflicting metadata declaration mechanisms
249
+
250
+ ### Page structure and images
251
+
252
+ - Missing or multiple H1 headings
253
+ - Skipped heading levels
254
+ - Very thin page content
255
+ - Standard and Next.js images without `alt`
256
+ - Empty `alt` values that may require review
257
+
258
+ Crawlemon never invents image descriptions.
259
+
260
+ ### Links and routes
261
+
262
+ - Broken internal links
263
+ - Placeholder or malformed internal links
264
+ - Links that create avoidable redirect hops
265
+ - Duplicate routes
266
+ - Redirect self-loops and redirect cycles
267
+ - Orphan and dead-end routes
268
+
269
+ ### Crawlability and structured data
270
+
271
+ - Missing robots and sitemap files
272
+ - Malformed or empty XML sitemaps
273
+ - Sitemap URLs that do not match discovered routes
274
+ - Public routes blocked by obvious robots directives
275
+ - Homepage `noindex`
276
+ - Noindex pages listed in a sitemap
277
+ - Malformed JSON-LD
278
+ - Required fields for common supported schema types
279
+
280
+ ## Deterministic scoring
281
+
282
+ AI never affects the SEO score.
283
+
284
+ Each severity has a fixed penalty:
285
+
286
+ | Severity | Penalty |
287
+ | --- | ---: |
288
+ | Error | 15 |
289
+ | Warning | 6 |
290
+ | Info | 2 |
291
+
292
+ The overall score uses these category weights:
293
+
294
+ | Category | Weight |
295
+ | --- | ---: |
296
+ | Technical | 30% |
297
+ | Metadata | 30% |
298
+ | Content | 20% |
299
+ | Internal links | 20% |
300
+
301
+ Repeated instances of the same rule are capped within a category. A single systemic mistake therefore remains comparable across small and large repositories.
302
+
303
+ ## CI examples
304
+
305
+ ### GitHub Actions
306
+
307
+ ```yaml
308
+ name: SEO
309
+
310
+ on:
311
+ pull_request:
312
+
313
+ jobs:
314
+ audit:
315
+ runs-on: ubuntu-latest
316
+ steps:
317
+ - uses: actions/checkout@v4
318
+ - uses: actions/setup-node@v4
319
+ with:
320
+ node-version: 20
321
+ - run: npx --yes crawlemon audit
322
+ env:
323
+ CI: true
324
+ ```
325
+
326
+ No application build or dependency installation is required for the static audit.
327
+
328
+ ## Security and privacy
329
+
330
+ - Local CLI scans remain on your machine or CI runner.
331
+ - No Crawlemon account or telemetry endpoint is required.
332
+ - Project code is analyzed as text and is never imported or executed.
333
+ - API keys are not required for deterministic functionality.
334
+ - Crawlemon warns when an environment file may be tracked or missing from `.gitignore`.
335
+ - Secret values are never printed by the secret-risk check.
336
+ - Fixes are restricted to files inside the detected project root.
337
+
338
+ For the hosted GitHub workflow and full threat model, see the project `SECURITY.md`.
339
+
340
+ ## Troubleshooting
341
+
342
+ ### No Next.js application detected
343
+
344
+ Run Crawlemon from the directory containing your Next.js `package.json`, `app/`, `pages/`, or `next.config` file.
345
+
346
+ ```bash
347
+ cd path/to/your-next-app
348
+ npx crawlemon audit
349
+ ```
350
+
351
+ ### Canonical or sitemap fix is unavailable
352
+
353
+ Add a valid production `siteUrl` to `seo.config.ts`. Crawlemon intentionally refuses to invent a domain.
354
+
355
+ ### A route is reported as an orphan
356
+
357
+ Add a crawlable internal link from an existing page. Links rendered only after client-side runtime behavior may not be visible to static analysis.
358
+
359
+ ### Static analysis does not detect generated metadata
360
+
361
+ Values created dynamically by `generateMetadata`, remote APIs, runtime environment variables, CMS data, or React component abstractions may require manual review. Crawlemon favors transparent static evidence and does not execute the application to guess runtime output.
362
+
363
+ ## GitHub pull-request automation
364
+
365
+ The open-source CLI works independently. The optional Crawlemon GitHub App adds automatic pull-request regression checks, scan history, and safe fix pull requests without requiring personal access tokens.
366
+
367
+ The GitHub integration is configured separately from this npm package.
368
+
369
+ ## Scope
370
+
371
+ The current release supports Next.js only. Crawlemon is intentionally not a backlink database, rank tracker, competitor-analysis platform, or automatic content publisher.
372
+
373
+ ## License
374
+
375
+ MIT
package/bin/autoseo.js ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { runCli } from "../dist/index.js";
4
+
5
+ const args = process.argv.slice(2);
6
+
7
+ runCli(args).catch((err) => {
8
+ console.error("\x1b[31mCrawlemon CLI Error:\x1b[0m", err?.message || err);
9
+ process.exit(1);
10
+ });
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { runCli } from "../dist/index.js";
4
+
5
+ const args = process.argv.slice(2);
6
+
7
+ runCli(args).catch((err) => {
8
+ console.error("\x1b[31mCrawlemon CLI Error:\x1b[0m", err?.message || err);
9
+ process.exit(1);
10
+ });
@@ -0,0 +1 @@
1
+ export declare function runCli(args: string[]): Promise<void>;