answerlint 1.1.1

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/README.md ADDED
@@ -0,0 +1,558 @@
1
+ # answerlint
2
+
3
+ [![npm version](https://img.shields.io/npm/v/answerlint.svg)](https://www.npmjs.com/package/answerlint)
4
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](#license)
5
+
6
+ `answerlint` is an open-source CLI for auditing whether web content is ready for answer engines, AI search, and citation-driven discovery.
7
+
8
+ It helps teams answer three practical questions:
9
+
10
+ - Is this page structured clearly enough for AI systems to summarize, trust, and cite?
11
+ - How does this page compare with a competitor or reference page?
12
+ - Did this pull request improve or weaken AI visibility before it ships?
13
+
14
+ The package reads pages, local files, folders, sitemaps, or existing audit reports, runs a deterministic AEO/GEO rubric, and produces reports with scores, evidence, and recommended fixes.
15
+
16
+ ![HTML audit report - composite, AEO/GEO gauges, and per-check results](assets/report-hero.png)
17
+
18
+ ## Why It Exists
19
+
20
+ Traditional SEO checks do not always reveal whether a page is useful to AI answer engines.
21
+
22
+ A page can rank in search and still be weak for:
23
+
24
+ - direct answer extraction
25
+ - entity and topic clarity
26
+ - source and authorship trust
27
+ - freshness signals
28
+ - external proof links
29
+ - comparison-friendly content
30
+ - citation readiness
31
+
32
+ `answerlint` is designed to be a lightweight quality gate for that layer of work. Think of it like Lighthouse or ESLint, but for AI visibility signals in content.
33
+
34
+ ## What Makes It Different
35
+
36
+ - **Deterministic by default**: no hidden LLM judge is required to score a page.
37
+ - **Evidence-backed**: every audit produces a pass, warning, or failure with supporting evidence.
38
+ - **CI-friendly**: use score thresholds and diff gates to fail a build when visibility regresses.
39
+ - **Readable for humans**: HTML reports make it easy for content, SEO, and engineering teams to review the same findings.
40
+ - **Reusable for tooling**: JSON and CSV outputs are stable enough for dashboards, PR comments, and downstream automation.
41
+ - **Useful before shipping**: AI Visibility Diff compares baseline and pull request reports before changes go live.
42
+
43
+ ## Features
44
+
45
+ Current CLI commands:
46
+
47
+ - `answerlint overview`
48
+ - `answerlint info`
49
+ - `answerlint audit`
50
+ - `answerlint diff`
51
+
52
+ Supported audit inputs:
53
+
54
+ - live URL
55
+ - local Markdown or HTML file
56
+ - local folder of content files
57
+ - sitemap or sitemap index
58
+
59
+ Supported outputs:
60
+
61
+ - HTML for human review
62
+ - JSON for automation
63
+ - CSV for batch audit summaries
64
+ - HTML or JSON diff reports for pull request workflows
65
+ - competitor comparison reports when `audit --compare` is used with `--url`
66
+
67
+ ## Quick Start
68
+
69
+ Fastest way to understand the product:
70
+
71
+ - website and playground: [answerlint.vercel.app](https://answerlint.vercel.app/)
72
+ - npm package: [answerlint on npm](https://www.npmjs.com/package/answerlint)
73
+ - source code: [GitHub repo](https://github.com/rakeshcheekatimala/answerlint)
74
+
75
+ Run without installing globally:
76
+
77
+ ```bash
78
+ npx answerlint overview
79
+ ```
80
+
81
+ Install globally:
82
+
83
+ ```bash
84
+ npm install -g answerlint
85
+ ```
86
+
87
+ Audit one live page:
88
+
89
+ ```bash
90
+ answerlint audit \
91
+ --url "https://example.com/docs/article" \
92
+ --output html \
93
+ --output-path ./answerlint-report.html
94
+ ```
95
+
96
+ Audit one local file:
97
+
98
+ ```bash
99
+ answerlint audit \
100
+ --file ./examples/sample.html \
101
+ --output json \
102
+ --output-path ./answerlint-report.json
103
+ ```
104
+
105
+ Audit a folder:
106
+
107
+ ```bash
108
+ answerlint audit \
109
+ --dir ./examples \
110
+ --output csv \
111
+ --output-path ./answerlint-batch.csv
112
+ ```
113
+
114
+ Audit a sitemap:
115
+
116
+ ```bash
117
+ answerlint audit \
118
+ --sitemap "https://example.com/sitemap.xml" \
119
+ --output csv \
120
+ --output-path ./answerlint-sitemap.csv
121
+ ```
122
+
123
+ ## Competitor Compare
124
+
125
+ Competitor compare audits a target URL and a competitor or reference URL side by side.
126
+
127
+ Use it when you want to understand where another page has stronger answerability, citation, schema, or trust signals.
128
+
129
+ ```bash
130
+ answerlint audit \
131
+ --url "https://example.com/docs/article" \
132
+ --compare "https://competitor.example/docs/article" \
133
+ --output html \
134
+ --output-path ./answerlint-compare-report.html
135
+ ```
136
+
137
+ Generate a JSON comparison report:
138
+
139
+ ```bash
140
+ answerlint audit \
141
+ --url "https://example.com/docs/article" \
142
+ --compare "https://competitor.example/docs/article" \
143
+ --output json \
144
+ --output-path ./answerlint-compare-report.json
145
+ ```
146
+
147
+ Compare mode is currently supported for `--url` audits. Folder, file, and sitemap comparison workflows are planned follow-ups.
148
+
149
+ ## AI Visibility Diff
150
+
151
+ AI Visibility Diff compares a baseline audit report with a current pull request report. It shows whether a change improved or regressed AI visibility.
152
+
153
+ This is useful in CI because it catches content and markup regressions before deployment.
154
+
155
+ Compare two existing JSON audit reports:
156
+
157
+ ```bash
158
+ answerlint diff \
159
+ --base-report ./baseline-report.json \
160
+ --head-report ./current-report.json \
161
+ --output html \
162
+ --output-path ./answerlint-diff-report.html
163
+ ```
164
+
165
+ Generate a machine-readable diff:
166
+
167
+ ```bash
168
+ answerlint diff \
169
+ --base-report ./baseline-report.json \
170
+ --head-report ./current-report.json \
171
+ --output json \
172
+ --output-path ./answerlint-diff-report.json
173
+ ```
174
+
175
+ Fail CI when visibility regresses:
176
+
177
+ ```bash
178
+ answerlint diff \
179
+ --base-report ./baseline-report.json \
180
+ --head-report ./current-report.json \
181
+ --fail-on-regression \
182
+ --max-composite-drop 0 \
183
+ --max-aeo-drop 0 \
184
+ --max-geo-drop 0 \
185
+ --max-citation-readiness-drop 0
186
+ ```
187
+
188
+ Require minimum improvements:
189
+
190
+ ```bash
191
+ answerlint diff \
192
+ --base-report ./baseline-report.json \
193
+ --head-report ./current-report.json \
194
+ --min-composite-delta 0 \
195
+ --min-aeo-delta 0 \
196
+ --min-geo-delta 0
197
+ ```
198
+
199
+ Example diff summary:
200
+
201
+ ```json
202
+ {
203
+ "summary": {
204
+ "status": "improved",
205
+ "baseScore": 74,
206
+ "headScore": 82,
207
+ "delta": 8
208
+ },
209
+ "scoreDiffs": {
210
+ "composite": {
211
+ "base": 74,
212
+ "head": 82,
213
+ "delta": 8,
214
+ "status": "improved"
215
+ },
216
+ "aeo": {
217
+ "base": 78,
218
+ "head": 85,
219
+ "delta": 7,
220
+ "status": "improved"
221
+ }
222
+ },
223
+ "ci": {
224
+ "passed": true,
225
+ "reasons": []
226
+ }
227
+ }
228
+ ```
229
+
230
+ ## What It Checks
231
+
232
+ The current audit rubric contains 12 deterministic checks.
233
+
234
+ ### AEO
235
+
236
+ - FAQ or HowTo schema
237
+ - direct answer in the first paragraph
238
+ - Q&A density
239
+ - readability
240
+ - named entities
241
+ - author byline
242
+
243
+ ### GEO
244
+
245
+ - topical depth
246
+ - trust signals
247
+ - content freshness
248
+ - external citations
249
+ - comparison content
250
+ - citation likelihood
251
+
252
+ Diff reports also derive higher-level comparison signals such as citation readiness, schema quality, content clarity, entity coverage, evidence quality, author/date/source signals, answerability, and AI extractability.
253
+
254
+ ## How Scoring Works
255
+
256
+ The workflow is intentionally simple:
257
+
258
+ 1. Read content from a URL, file, folder, sitemap, or JSON report.
259
+ 2. Normalize and parse content.
260
+ 3. Run deterministic AEO and GEO checks.
261
+ 4. Compute `aeo`, `geo`, and `composite` scores.
262
+ 5. Attach recommendations for failed or warning checks.
263
+ 6. Write a report in HTML, JSON, CSV, comparison, or diff format.
264
+
265
+ Score bands:
266
+
267
+ | Band | Meaning |
268
+ |---|---|
269
+ | `poor` | Major AI visibility gaps |
270
+ | `needs-improvement` | Useful foundation, but important signals are missing |
271
+ | `good` | Strong baseline for answer and citation readiness |
272
+ | `excellent` | Well-structured, evidence-rich, and easy to extract |
273
+
274
+ By default, AEO contributes `50%` and GEO contributes `50%` to the composite score.
275
+
276
+ ## CI Examples
277
+
278
+ Fail a deployment preview if the page score is below a threshold:
279
+
280
+ ```bash
281
+ answerlint audit \
282
+ --url "$DEPLOY_URL" \
283
+ --ci \
284
+ --threshold 70 \
285
+ --output json \
286
+ --output-path ./answerlint-report.json
287
+ ```
288
+
289
+ Compare mode does not change CI threshold behavior. When `--ci` and `--compare` are used together, the threshold is checked against the target URL composite score only; competitor scores and deltas are reported for context.
290
+
291
+ Fail a pull request if the current report regresses against the baseline:
292
+
293
+ ```bash
294
+ answerlint diff \
295
+ --base-report ./baseline-report.json \
296
+ --head-report ./current-report.json \
297
+ --output json \
298
+ --output-path ./answerlint-diff-report.json \
299
+ --fail-on-regression \
300
+ --fail-on-high-severity
301
+ ```
302
+
303
+ GitHub Actions sketch:
304
+
305
+ ```yaml
306
+ name: AI Visibility
307
+
308
+ on:
309
+ pull_request:
310
+ branches:
311
+ - main
312
+
313
+ jobs:
314
+ answerlint:
315
+ runs-on: ubuntu-latest
316
+
317
+ steps:
318
+ - uses: actions/checkout@v4
319
+
320
+ - uses: actions/setup-node@v4
321
+ with:
322
+ node-version: 20
323
+
324
+ - run: npm ci
325
+
326
+ - name: Audit baseline
327
+ run: |
328
+ npx answerlint audit \
329
+ --url "https://example.com/page" \
330
+ --output json \
331
+ --output-path ./baseline-report.json
332
+
333
+ - name: Audit preview
334
+ run: |
335
+ npx answerlint audit \
336
+ --url "$DEPLOY_PREVIEW_URL" \
337
+ --output json \
338
+ --output-path ./current-report.json
339
+
340
+ - name: Compare AI visibility
341
+ run: |
342
+ npx answerlint diff \
343
+ --base-report ./baseline-report.json \
344
+ --head-report ./current-report.json \
345
+ --output html \
346
+ --output-path ./answerlint-diff-report.html \
347
+ --fail-on-regression
348
+ ```
349
+
350
+ Exit codes:
351
+
352
+ | Exit code | Meaning |
353
+ |---|---|
354
+ | 0 | Success |
355
+ | 1 | CI gate failure |
356
+ | 2 | Crawl or runtime error |
357
+ | 3 | Invalid input, config, or diff report |
358
+
359
+ ## Command Reference
360
+
361
+ ```text
362
+ answerlint overview
363
+ answerlint info
364
+
365
+ answerlint audit [options]
366
+ --url <url>
367
+ --file <path>
368
+ --dir <path>
369
+ --sitemap <url>
370
+ --output <format> html | json | csv
371
+ --output-path <path>
372
+ --threshold <n>
373
+ --ci
374
+ --ignore-robots
375
+ --depth <n>
376
+ --rate <n>
377
+ --config <path>
378
+ --probe
379
+ --models <list>
380
+ --compare <url>
381
+
382
+ answerlint diff [options]
383
+ --base-report <path>
384
+ --head-report <path>
385
+ --output <format> html | json
386
+ --output-path <path>
387
+ --fail-on-regression
388
+ --fail-on-high-severity
389
+ --max-composite-drop <n>
390
+ --max-aeo-drop <n>
391
+ --max-geo-drop <n>
392
+ --max-citation-readiness-drop <n>
393
+ --min-composite-delta <n>
394
+ --min-aeo-delta <n>
395
+ --min-geo-delta <n>
396
+ --min-citation-readiness-delta <n>
397
+ ```
398
+
399
+ Current implementation notes:
400
+
401
+ - `--compare` audits the target and competitor URLs side by side; it is only supported with `--url`.
402
+ - `diff` currently compares existing JSON audit reports.
403
+ - live URL diff, sitemap diff, and PR comment output are planned follow-ups.
404
+ - `--probe` exists, but probe mode is not implemented yet.
405
+ - `--depth` is accepted, but the current crawler does not use it yet.
406
+ - `html` and `json` audit outputs currently write only the first report for folder and sitemap runs.
407
+
408
+ ## Configuration
409
+
410
+ Optional config loading order:
411
+
412
+ 1. `--config <path>`
413
+ 2. `.answerlint.json` in the current project
414
+ 3. `.answerlint.json` in the home directory
415
+
416
+ Example:
417
+
418
+ ```json
419
+ {
420
+ "audit": {
421
+ "aeo_weight": 0.5,
422
+ "geo_weight": 0.5,
423
+ "custom_weights": {
424
+ "faq_schema": 1.5,
425
+ "direct_answer": 1.5,
426
+ "citation_likelihood": 1.3
427
+ }
428
+ },
429
+ "ci": {
430
+ "threshold": 70,
431
+ "fail_on_drop": true
432
+ }
433
+ }
434
+ ```
435
+
436
+ ## Best Practices
437
+
438
+ Start with one known page before running a folder or sitemap audit. It is easier to validate the rubric and review recommendations on content you understand well.
439
+
440
+ Use `html` when a person will read the report. Use `json` or `csv` when another tool will consume it.
441
+
442
+ Use `csv` for real batch audit runs. It is the only audit format that currently emits every page in a folder or sitemap audit.
443
+
444
+ Use `audit --compare` when you want a live side-by-side benchmark against a competitor, reference page, or category leader.
445
+
446
+ Use `diff` in pull requests. A single score is useful, but a before/after comparison is more useful for release decisions.
447
+
448
+ Treat scores as prioritization signals, not guarantees. This project helps improve content quality systematically; it does not promise rankings, citations, or model behavior.
449
+
450
+ If your site is heavily client-rendered, audit rendered HTML output or local exports when possible. The current implementation does not run a browser.
451
+
452
+ Respect `robots.txt`, rate limits, and site terms when auditing third-party URLs.
453
+
454
+ ## Local Development
455
+
456
+ ```bash
457
+ git clone https://github.com/rakeshcheekatimala/answerlint.git
458
+ cd answerlint
459
+ npm install
460
+ npm run lint
461
+ npm run build
462
+ npm test
463
+ npm run test:coverage
464
+ ```
465
+
466
+ Useful smoke tests:
467
+
468
+ ```bash
469
+ node dist/index.js audit --file ./examples/sample.html --output html --output-path ./sample-report.html
470
+ node dist/index.js audit --file ./examples/sample.md --output json --output-path ./sample-report.json
471
+ node dist/index.js audit --dir ./examples --output csv --output-path ./examples-report.csv
472
+ node dist/index.js audit --url "https://example.com" --compare "https://www.iana.org/help/example-domains" --output json --output-path ./compare-report.json
473
+ node dist/index.js diff --base-report ./sample-report.json --head-report ./sample-report.json --output html --output-path ./sample-diff.html
474
+ ```
475
+
476
+ Coverage artifacts are written to:
477
+
478
+ - [coverage/index.html](coverage/index.html)
479
+ - [coverage/report.md](coverage/report.md)
480
+ - [coverage/summary.json](coverage/summary.json)
481
+
482
+ ## Contributing
483
+
484
+ Contributions are welcome. The project is intentionally small, deterministic, and practical.
485
+
486
+ Good contribution areas include:
487
+
488
+ - new AEO/GEO checks with clear evidence
489
+ - better scoring explainability
490
+ - richer compare and diff reports
491
+ - GitHub Action and PR comment workflows
492
+ - sitemap and batch reporting improvements
493
+ - documentation and real-world examples
494
+
495
+ Please read [CONTRIBUTING.md](CONTRIBUTING.md) before opening a pull request.
496
+
497
+ ## Project Health
498
+
499
+ Latest verified local snapshot on `2026-07-02`:
500
+
501
+ | Metric | Status |
502
+ |---|---|
503
+ | Typecheck | `npm run lint` passing |
504
+ | Build | `npm run build` passing |
505
+ | Tests | `39/39` passing with Node 23.11.0 |
506
+
507
+ Note: the current `npm test` script uses `node --import`, so contributors should run tests with a Node version that supports that flag. Node 20+ is recommended for local development.
508
+
509
+ ## Roadmap
510
+
511
+ Planned directions:
512
+
513
+ - live URL diff without pre-generated JSON reports
514
+ - sitemap-to-sitemap diff reports
515
+ - GitHub PR comments
516
+ - Markdown CI summaries
517
+ - historical baselines
518
+ - browser-rendered audits for client-heavy pages
519
+ - optional LLM probe workflows
520
+ - competitor diff mode
521
+
522
+ ## Docs
523
+
524
+ - [CONTRIBUTING.md](CONTRIBUTING.md)
525
+ - [docs/requirements.md](docs/requirements.md)
526
+ - [docs/suggestions.md](docs/suggestions.md)
527
+
528
+ ## Limitations
529
+
530
+ - no browser rendering for JavaScript-heavy pages
531
+ - no implemented probe workflow yet
532
+ - no live URL or sitemap diff workflow yet
533
+ - no recursive local directory traversal
534
+ - no aggregated HTML or JSON output for multi-page batch audit runs
535
+
536
+ ## Release Process
537
+
538
+ Releases are automated with `semantic-release` from `main`.
539
+
540
+ Version bumps follow conventional commits:
541
+
542
+ - `fix:` for patch releases
543
+ - `feat:` for minor releases
544
+ - `feat!:` or `BREAKING CHANGE:` for major releases
545
+
546
+ Preview the next version locally:
547
+
548
+ ```bash
549
+ npm run release:dry-run
550
+ ```
551
+
552
+ `semantic-release` itself requires Node 24 for the release step, so the local dry run uses an ephemeral Node 24 runtime even if day-to-day development uses Node 20+.
553
+
554
+ The release workflow runs typecheck, build, and tests, then publishes to npm and creates a GitHub release when the commit history since the last tag contains a releasable change.
555
+
556
+ ## License
557
+
558
+ MIT
Binary file
Binary file
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node