@agentimization/core 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 Anthony Lio
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,193 @@
1
+ <p align="center">
2
+ <img src="https://img.shields.io/npm/v/agentimization?style=flat-square&color=blue" alt="npm version" />
3
+ <img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="license" />
4
+ <img src="https://img.shields.io/badge/checks-35-purple?style=flat-square" alt="checks" />
5
+ </p>
6
+
7
+ <h1 align="center">agentimization</h1>
8
+
9
+ <p align="center">
10
+ GEO audit for agent-ready websites.<br/>
11
+ One command to check if AI agents can discover, parse, and cite your content.
12
+ </p>
13
+
14
+ ---
15
+
16
+ ## Why
17
+
18
+ AI agents (Claude, ChatGPT, Perplexity, Gemini) are becoming a major source of traffic and citations. But most websites are invisible to them — no `llms.txt`, no markdown endpoints, no structured data, client-rendered content that crawlers can't read.
19
+
20
+ **Agentimization** runs checks across 8 categories and gives you a GEO score from 0–100, with specific fixes you can hand off to an AI coding agent.
21
+
22
+ ## Install
23
+
24
+ ```bash
25
+ npx agentimization https://your-site.com
26
+ ```
27
+
28
+ Or install globally:
29
+
30
+ ```bash
31
+ npm install -g agentimization
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ### Audit a live site
37
+
38
+ ```bash
39
+ agentimization https://docs.anthropic.com
40
+ ```
41
+
42
+ ```text
43
+ ╭───────────────────────────────────────────────╮
44
+ │ ▓░▒▓░░▒░▓▒░▓▓░▒░▓░░▒▓▒░▓░░▓▒░▓░▒░▓░░▒▓░░ │
45
+ │ ░▓▒░▓░░▒▓▒░▓░░▒▓▓░▒░▓▒░░▓▒░▓░▒░░▓▒░░▓░▒ │
46
+ │ ▓░▒▓░░▒▓▒░░▓░▒▓▒░░▓░░▓▒░▓░▒░░▓▒░▓░░▒▓░ │
47
+ │ ░▒▓░▒░▓▒░░▓░▒▓░░▒▓▒░░▓░▒▓░░▒▓░ agentimization │
48
+ │ │
49
+ │ https://docs.anthropic.com │
50
+ │ │
51
+ │ Crawling the site, one sec… │
52
+ ╰───────────────────────────────────────────────╯
53
+ ```
54
+
55
+ ### Audit a local directory (great for CI)
56
+
57
+ ```bash
58
+ agentimization .
59
+ agentimization ./docs
60
+ ```
61
+
62
+ ### Output formats
63
+
64
+ ```bash
65
+ # JSON for CI pipelines
66
+ agentimization https://example.com --json
67
+
68
+ # Markdown report — paste into Claude, ChatGPT, etc.
69
+ agentimization https://example.com --md
70
+
71
+ # Filter by category
72
+ agentimization https://example.com --category content-discoverability
73
+ ```
74
+
75
+ ### After the audit
76
+
77
+ Agentimization shows an interactive menu when the audit finishes:
78
+
79
+ - **Copy fix prompt to clipboard** — structured markdown an AI coding agent can use to fix your GEO issues
80
+ - **Save JSON report** — full audit data written to `agentimization-report.json`
81
+ - **Run another URL or path** — keep the session open and audit the next site
82
+ - **Exit**
83
+
84
+ ## Checks
85
+
86
+ Agentimization runs **36 checks** across **8 categories**:
87
+
88
+ | Category | What it checks |
89
+ |---|---|
90
+ | **Content Discoverability** | `llms.txt` existence, structure, size, coverage, link resolution. Sitemap presence. `robots.txt` AI agent rules. |
91
+ | **Markdown Availability** | `.md` URL support, `Accept: text/markdown` content negotiation, HTML↔markdown parity. |
92
+ | **Content Structure** | Code fence validity, heading hierarchy, tabbed content serialization. |
93
+ | **Page Size & Rendering** | SSR vs CSR detection, HTML/markdown page size, content start position (boilerplate ratio). |
94
+ | **URL Stability** | HTTP status codes, redirect behavior, cache header hygiene. |
95
+ | **Authentication & Access** | Auth gate detection, alternative access paths for gated content. |
96
+ | **GEO Signals** | Structured data (JSON-LD), citation worthiness, topical authority, content freshness, E-E-A-T signals, FAQ schema, canonical URLs. |
97
+ | **Agent Protocols** | AGENTS.md, MCP server card, API catalog (RFC 9727), content signals (AI usage declarations), Link headers (RFC 8288), agent skills index. |
98
+
99
+ ## Scoring
100
+
101
+ Each check returns **pass**, **warn**, **fail**, **skip**, or **info**. Checks are weighted by importance, and scores roll up into category scores and an overall grade:
102
+
103
+ | Grade | Score |
104
+ |---|---|
105
+ | A+ | 95–100 |
106
+ | A | 85–94 |
107
+ | B | 70–84 |
108
+ | C | 55–69 |
109
+ | D | 40–54 |
110
+ | F | 0–39 |
111
+
112
+ ## Example scores
113
+
114
+ How popular sites score on Agentimization (approximate, scores change as sites update):
115
+
116
+ | Site | Grade | Score | Notes |
117
+ |---|---|---|---|
118
+ | `docs.anthropic.com` | **A** | 88 | Strong `llms.txt`, good markdown, structured data |
119
+ | `docs.stripe.com` | **A** | 91 | Excellent discoverability, markdown endpoints, great structure |
120
+ | `nextjs.org/docs` | **B** | 76 | Good SSR, missing `llms.txt`, decent GEO signals |
121
+ | `react.dev` | **B** | 72 | Good structure, no `llms.txt`, client-heavy rendering |
122
+ | `en.wikipedia.org` | **A** | 86 | Great content structure, strong citations, no `llms.txt` |
123
+ | `medium.com` | **D** | 45 | Auth gates, weak markdown, no `llms.txt` |
124
+ | `substack.com` | **C** | 58 | Mixed access, some content gated |
125
+
126
+ > These are illustrative examples. Run `agentimization <url>` to get real-time scores.
127
+
128
+ ## Local mode
129
+
130
+ When you pass a directory path instead of a URL, Agentimization runs in **local mode**:
131
+
132
+ - Scans your files on disk (HTML, markdown, `llms.txt`, `robots.txt`, `sitemap.xml`)
133
+ - Skips network-only checks (content negotiation, auth detection, cache headers, etc.)
134
+ - Perfect as a **CI pre-deploy step** — catch GEO regressions before they ship
135
+
136
+ ```bash
137
+ # In CI
138
+ agentimization . --json
139
+ # Exit code 1 if score < 50
140
+ ```
141
+
142
+ ## Programmatic API
143
+
144
+ ```typescript
145
+ import { audit, auditLocal } from "@agentimization/core"
146
+
147
+ // Remote audit
148
+ const result = await audit("https://docs.anthropic.com")
149
+ console.log(result.grade, result.overall_score)
150
+
151
+ // Local audit
152
+ const local = await auditLocal("./docs")
153
+ console.log(local.grade, local.overall_score)
154
+
155
+ // With options
156
+ const result = await audit("https://example.com", {
157
+ sampleSize: 20,
158
+ categories: ["content-discoverability", "geo-signals"],
159
+ onEvent: (event) => console.log(event),
160
+ })
161
+ ```
162
+
163
+ ## What is GEO?
164
+
165
+ **Generative Engine Optimization** is like SEO, but for AI. Instead of optimizing for Google's crawlers and ranking algorithm, GEO optimizes for AI agents that need to:
166
+
167
+ 1. **Discover** your content (via `llms.txt`, sitemaps, `robots.txt`)
168
+ 2. **Parse** it efficiently (markdown availability, clean HTML, SSR)
169
+ 3. **Cite** it accurately (structured data, canonical URLs, E-E-A-T signals)
170
+
171
+ Sites that score well on Agentimization are more likely to be surfaced and cited by Claude, ChatGPT, Perplexity, and other generative engines.
172
+
173
+ ## Contributing
174
+
175
+ ```bash
176
+ git clone https://github.com/antlio/agentimization
177
+ cd agentimization
178
+ bun install
179
+ bun run build
180
+ bun run typecheck
181
+ ```
182
+
183
+ The monorepo structure:
184
+
185
+ ```
186
+ packages/shared — Types, schemas, constants
187
+ packages/core — Audit engine + all 36 checks
188
+ apps/cli — CLI (Commander.js + Ink)
189
+ ```
190
+
191
+ ## License
192
+
193
+ MIT
@@ -0,0 +1,14 @@
1
+ import { CheckDefinition, AgentimizationConfig, AuditContext, AuditResult } from '@agentimization/shared';
2
+ export { AgentimizationConfig, AuditContext, AuditEvent, AuditEventHandler, AuditMode, AuditResult, CheckCategory, CheckDefinition, CheckResult } from '@agentimization/shared';
3
+
4
+ declare const ALL_CHECKS: CheckDefinition[];
5
+
6
+ /** Build an AuditContext from a local directory */
7
+ declare const buildLocalContext: (dirPath: string, config: Required<AgentimizationConfig>) => AuditContext;
8
+
9
+ /** Run a full GEO audit on a URL (remote mode) */
10
+ declare const audit: (targetUrl: string, config?: AgentimizationConfig) => Promise<AuditResult>;
11
+ /** Run a GEO audit on a local directory (local mode) */
12
+ declare const auditLocal: (dirPath: string, config?: AgentimizationConfig) => Promise<AuditResult>;
13
+
14
+ export { ALL_CHECKS, audit, auditLocal, buildLocalContext };