geo-semantic-layer 2.0.2 → 3.0.0-alpha.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 CHANGED
@@ -1,14 +1,13 @@
1
- # GEO Semantic Layer
1
+ # geo-semantic-layer
2
2
 
3
- Framework-agnostic TypeScript library for Generative Engine Optimization (GEO) and structured data automation.
3
+ > Smart JSON-LD toolkit for Generative Engine Optimization (GEO)
4
4
 
5
- Build type-safe, validated JSON-LD schemas that work in any JavaScript environment: React, Vue, Angular, Svelte, Astro, Next.js, Nuxt, Remix, Node.js, Deno, Bun, edge runtimes, and vanilla JavaScript.
6
-
7
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue.svg)](https://www.typescriptlang.org/)
9
- [![npm version](https://badge.fury.io/js/geo-semantic-layer.svg)](https://www.npmjs.com/package/geo-semantic-layer)
10
-
11
- ---
5
+ This is the **complete bundle** package that includes all modules:
6
+ - `@semantic-layer/core` - Schema generators & validators
7
+ - `@semantic-layer/extractor` - Extract structured data from HTML
8
+ - `@semantic-layer/optimizer` - Optimize schemas for LLMs
9
+ - `@semantic-layer/auditor` - Audit sites for schema quality
10
+ - `@semantic-layer/cli` - Command-line tools
12
11
 
13
12
  ## Installation
14
13
 
@@ -16,66 +15,117 @@ Build type-safe, validated JSON-LD schemas that work in any JavaScript environme
16
15
  npm install geo-semantic-layer
17
16
  ```
18
17
 
19
- No framework-specific packages. No peer dependencies.
20
-
21
- ---
22
-
23
18
  ## Quick Start
24
19
 
20
+ ### 1️⃣ Generate Your First Schema
21
+
25
22
  ```typescript
26
23
  import { generateArticleSchema } from 'geo-semantic-layer';
27
24
 
28
25
  const schema = generateArticleSchema({
29
- headline: 'The Future of GEO in 2026',
30
- image: 'https://example.com/article.jpg',
31
- author: 'John Doe',
32
- datePublished: '2026-01-06',
33
- description: 'How AI models consume structured data',
34
- publisher: {
35
- name: 'My Site',
36
- logo: 'https://example.com/logo.png'
26
+ headline: 'Understanding JSON-LD',
27
+ author: 'Jane Smith',
28
+ datePublished: '2026-01-09',
29
+ description: 'A comprehensive guide to structured data',
30
+ image: 'https://example.com/image.jpg',
31
+ articleBody: 'Full article content goes here...',
32
+ });
33
+ ```
34
+
35
+ ### 2️⃣ Insert into Your HTML
36
+
37
+ ```html
38
+ <script type="application/ld+json">
39
+ {
40
+ "@context": "https://schema.org",
41
+ "@type": "Article",
42
+ "headline": "Understanding JSON-LD",
43
+ ...
37
44
  }
45
+ </script>
46
+ ```
47
+
48
+ ### 3️⃣ That's it! 🎉
49
+
50
+ Your site now has structured data that Google and LLMs can understand.
51
+
52
+ ---
53
+
54
+ ## Advanced Features
55
+
56
+ ### Extract Data from HTML
57
+
58
+ ```typescript
59
+ import { extractFromURL } from 'geo-semantic-layer/extractor';
60
+
61
+ const data = await extractFromURL('https://example.com/article');
62
+ console.log(data.type); // 'Article'
63
+ console.log(data.metadata); // Extracted metadata
64
+ ```
65
+
66
+ ### Optimize for LLMs
67
+
68
+ ```typescript
69
+ import { optimizeForLLM } from 'geo-semantic-layer/optimizer';
70
+
71
+ const optimized = optimizeForLLM(schema, {
72
+ targetModel: 'gpt-4',
73
+ aggressiveness: 'medium',
38
74
  });
39
75
 
40
- // Insert into your HTML:
41
- // <script type="application/ld+json">{JSON.stringify(schema)}</script>
76
+ console.log(`Reduced ${optimized.stats.reduction}% tokens`);
77
+ ```
78
+
79
+ ### Audit Your Project
80
+
81
+ ```bash
82
+ # Lint and validate all schemas
83
+ npx geo-semantic-layer lint
84
+
85
+ # Pre-commit validation
86
+ npx geo-semantic-layer validate --strict
87
+
88
+ # Generate HTML report
89
+ npx geo-semantic-layer report -o audit.html
90
+ ```
91
+
92
+ ## Modular Installation
93
+
94
+ For tree-shaking and smaller bundles, install only what you need:
95
+
96
+ ```bash
97
+ npm install @semantic-layer/core @semantic-layer/optimizer
42
98
  ```
43
99
 
44
100
  ---
45
101
 
46
- ## Framework Integration
102
+ ## Framework Examples
47
103
 
48
104
  ### React / Next.js
49
105
 
50
106
  ```tsx
51
- import { generateOrganizationSchema } from 'geo-semantic-layer';
107
+ import { generateArticleSchema } from 'geo-semantic-layer';
52
108
 
53
- export default function RootLayout({ children }) {
54
- const schema = generateOrganizationSchema({
55
- name: 'My Company',
56
- url: 'https://example.com',
57
- logo: 'https://example.com/logo.png',
58
- sameAs: [
59
- 'https://wikidata.org/wiki/Q123',
60
- 'https://linkedin.com/company/example'
61
- ]
109
+ export default function Article() {
110
+ const schema = generateArticleSchema({
111
+ headline: 'My Article',
112
+ author: 'John Doe',
113
+ datePublished: '2026-01-09',
62
114
  });
63
115
 
64
116
  return (
65
- <html>
66
- <head>
67
- <script
68
- type="application/ld+json"
69
- dangerouslySetInnerHTML={{ __html: JSON.stringify(schema) }}
70
- />
71
- </head>
72
- <body>{children}</body>
73
- </html>
117
+ <>
118
+ <script
119
+ type="application/ld+json"
120
+ dangerouslySetInnerHTML={{ __html: JSON.stringify(schema) }}
121
+ />
122
+ <article>{/* Your content */}</article>
123
+ </>
74
124
  );
75
125
  }
76
126
  ```
77
127
 
78
- ### Vue 3 / Nuxt
128
+ ### Vue / Nuxt
79
129
 
80
130
  ```vue
81
131
  <script setup>
@@ -83,15 +133,8 @@ import { generateProductSchema } from 'geo-semantic-layer';
83
133
 
84
134
  const schema = generateProductSchema({
85
135
  name: 'Wireless Headphones',
86
- description: 'Premium noise-cancelling headphones',
87
- image: 'https://example.com/headphones.jpg',
88
136
  brand: 'AudioTech',
89
- offers: {
90
- price: 299.99,
91
- priceCurrency: 'USD',
92
- availability: 'InStock',
93
- url: 'https://example.com/products/headphones'
94
- }
137
+ offers: { price: 299.99, priceCurrency: 'USD' }
95
138
  });
96
139
  </script>
97
140
 
@@ -102,43 +145,15 @@ const schema = generateProductSchema({
102
145
  </template>
103
146
  ```
104
147
 
105
- ### Svelte / SvelteKit
106
-
107
- ```svelte
108
- <script>
109
- import { generateFAQSchema } from 'geo-semantic-layer';
110
-
111
- const schema = generateFAQSchema({
112
- questions: [
113
- {
114
- question: 'What is GEO?',
115
- answer: 'Generative Engine Optimization for AI search engines.'
116
- },
117
- {
118
- question: 'How does it work?',
119
- answer: 'By providing structured data AI models can easily consume.'
120
- }
121
- ]
122
- });
123
- </script>
124
-
125
- <svelte:head>
126
- <script type="application/ld+json">{JSON.stringify(schema)}</script>
127
- </svelte:head>
128
- ```
129
-
130
148
  ### Astro
131
149
 
132
150
  ```astro
133
151
  ---
134
- import { generateBreadcrumbSchema } from 'geo-semantic-layer';
135
-
136
- const schema = generateBreadcrumbSchema({
137
- items: [
138
- { name: 'Home', url: 'https://example.com' },
139
- { name: 'Products', url: 'https://example.com/products' },
140
- { name: 'Headphones', url: 'https://example.com/products/headphones' }
141
- ]
152
+ import { generateOrganizationSchema } from 'geo-semantic-layer';
153
+
154
+ const schema = generateOrganizationSchema({
155
+ name: 'My Company',
156
+ url: 'https://example.com',
142
157
  });
143
158
  ---
144
159
 
@@ -146,187 +161,35 @@ const schema = generateBreadcrumbSchema({
146
161
  <head>
147
162
  <script type="application/ld+json" set:html={JSON.stringify(schema)} />
148
163
  </head>
149
- <body>
150
- <slot />
151
- </body>
164
+ <body><slot /></body>
152
165
  </html>
153
166
  ```
154
167
 
155
- ### Angular
156
-
157
- ```typescript
158
- import { Component } from '@angular/core';
159
- import { generateLocalBusinessSchema } from 'geo-semantic-layer';
160
-
161
- @Component({
162
- selector: 'app-root',
163
- template: `
164
- <div [innerHTML]="schemaScript"></div>
165
- `
166
- })
167
- export class AppComponent {
168
- schema = generateLocalBusinessSchema({
169
- name: 'Coffee Shop Downtown',
170
- address: {
171
- streetAddress: '123 Main St',
172
- addressLocality: 'New York',
173
- addressRegion: 'NY',
174
- postalCode: '10001',
175
- addressCountry: 'US'
176
- },
177
- geo: {
178
- latitude: 40.7128,
179
- longitude: -74.0060
180
- },
181
- telephone: '+1-555-123-4567'
182
- });
183
-
184
- get schemaScript() {
185
- return `<script type="application/ld+json">${JSON.stringify(this.schema)}</script>`;
186
- }
187
- }
188
- ```
189
-
190
- ### Node.js / Express
191
-
192
- ```javascript
193
- import express from 'express';
194
- import { generateWebPageSchema } from 'geo-semantic-layer';
195
-
196
- const app = express();
197
-
198
- app.get('/', (req, res) => {
199
- const schema = generateWebPageSchema({
200
- name: 'Homepage',
201
- description: 'Welcome to our site',
202
- url: 'https://example.com'
203
- });
204
-
205
- res.send(`
206
- <!DOCTYPE html>
207
- <html>
208
- <head>
209
- <script type="application/ld+json">
210
- ${JSON.stringify(schema)}
211
- </script>
212
- </head>
213
- <body>
214
- <h1>Hello World</h1>
215
- </body>
216
- </html>
217
- `);
218
- });
219
- ```
220
-
221
168
  ---
222
169
 
223
170
  ## Available Schemas
224
171
 
225
- | Generator | Description |
226
- |-----------|-------------|
227
- | `generateOrganizationSchema()` | Company/business information |
228
- | `generatePersonSchema()` | Individual person profiles |
229
- | `generateProductSchema()` | E-commerce products with ratings |
230
- | `generateArticleSchema()` | Blog posts and articles |
231
- | `generateFAQSchema()` | Frequently asked questions |
172
+ | Generator | Use Case |
173
+ |-----------|----------|
174
+ | `generateOrganizationSchema()` | Companies, organizations |
175
+ | `generatePersonSchema()` | Personal profiles, authors |
176
+ | `generateProductSchema()` | E-commerce products |
177
+ | `generateArticleSchema()` | Blog posts, articles |
178
+ | `generateFAQSchema()` | FAQ pages |
232
179
  | `generateBreadcrumbSchema()` | Navigation breadcrumbs |
233
180
  | `generateLocalBusinessSchema()` | Physical business locations |
234
- | `generateEventSchema()` | Events and conferences |
235
- | `generateWebPageSchema()` | Individual web pages |
236
-
237
- ---
238
-
239
- ## Features
240
-
241
- ### GEO Optimization
242
-
243
- Optimize JSON-LD for AI model consumption:
244
-
245
- ```typescript
246
- import { generateArticleSchema } from 'geo-semantic-layer';
247
-
248
- const schema = generateArticleSchema({
249
- headline: 'My Article',
250
- author: 'John Doe',
251
- datePublished: '2026-01-06',
252
- articleBody: 'Very long article content...',
253
- geo: {
254
- contentDensity: 'high' // Prunes decorative data for LLMs
255
- }
256
- });
257
- ```
258
-
259
- ### Hallucination Guard
260
-
261
- Validates entity links against authoritative sources (Wikidata, LinkedIn) to prevent AI misattribution.
262
-
263
- ### Content Density Engine
264
-
265
- Automatically prunes decorative data to generate high-density JSON-LD optimized for LLM context windows.
266
-
267
- ### Schema Validation
268
-
269
- All schemas validated with Zod:
270
-
271
- ```typescript
272
- import { ArticleSchema } from 'geo-semantic-layer/schemas';
273
-
274
- try {
275
- const validated = ArticleSchema.parse(myData);
276
- } catch (error) {
277
- console.error('Invalid schema:', error);
278
- }
279
- ```
280
-
281
- ### TypeScript Types
282
-
283
- Full type safety:
284
-
285
- ```typescript
286
- import type { Article, Product, Organization } from 'geo-semantic-layer';
287
-
288
- const article: Article = {
289
- '@context': 'https://schema.org',
290
- '@type': 'Article',
291
- headline: 'My Article',
292
- // TypeScript enforces correct structure
293
- };
294
- ```
181
+ | `generateEventSchema()` | Events, conferences |
182
+ | `generateWebPageSchema()` | Generic web pages |
295
183
 
296
184
  ---
297
185
 
298
- ## Package Exports
299
-
300
- ```typescript
301
- // Main entry - all generators and schemas
302
- import { generateArticleSchema } from 'geo-semantic-layer';
186
+ ## Documentation
303
187
 
304
- // Schemas only
305
- import { ArticleSchema } from 'geo-semantic-layer/schemas';
306
-
307
- // Generators only
308
- import { generateArticleSchema } from 'geo-semantic-layer/generators';
309
-
310
- // GEO Engine only
311
- import { GeoProcessor } from 'geo-semantic-layer/geo';
312
- ```
313
-
314
- ---
315
-
316
- ## Contributing
317
-
318
- Contributions welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
319
-
320
- ---
188
+ - 📖 [Complete Documentation](https://github.com/bdovenbird/semantic-layer#readme)
189
+ - 🎓 [User Guide](https://github.com/bdovenbird/semantic-layer/blob/main/USER_GUIDE.md)
190
+ - 📚 [API Reference](https://github.com/bdovenbird/semantic-layer/blob/main/docs/API.md)
191
+ - 💡 [Examples](https://github.com/bdovenbird/semantic-layer/tree/main/examples)
321
192
 
322
193
  ## License
323
194
 
324
- MIT © 2026 Rafael Calderón (BDOvenbird Engineering)
325
-
326
- ---
327
-
328
- ## Links
329
-
330
- - [npm](https://www.npmjs.com/package/geo-semantic-layer)
331
- - [GitHub](https://github.com/bdovenbird/semantic-layer)
332
- - [Issues](https://github.com/bdovenbird/semantic-layer/issues)
195
+ MIT © Rafael Calderón (BDOvenbird Engineering)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "geo-semantic-layer",
3
- "version": "2.0.2",
4
- "description": "Framework-agnostic TypeScript library for Generative Engine Optimization (GEO) and structured data automation. Pure functions for JSON-LD generation.",
3
+ "version": "3.0.0-alpha.1",
4
+ "description": "Smart JSON-LD toolkit: Extract structured data from HTML, optimize for LLMs, and audit sites. Complete bundle with CLI and programmatic API.",
5
5
  "keywords": [
6
6
  "seo",
7
7
  "geo",
@@ -18,13 +18,14 @@
18
18
  "llm",
19
19
  "chatgpt",
20
20
  "perplexity",
21
- "universal",
22
- "zero-dependencies"
21
+ "llm-optimization",
22
+ "cli"
23
23
  ],
24
24
  "homepage": "https://github.com/bdovenbird/semantic-layer#readme",
25
25
  "repository": {
26
26
  "type": "git",
27
- "url": "https://github.com/bdovenbird/semantic-layer.git"
27
+ "url": "https://github.com/bdovenbird/semantic-layer.git",
28
+ "directory": "packages/geo-semantic-layer"
28
29
  },
29
30
  "license": "MIT",
30
31
  "author": "Rafael Calderón (BDOvenbird Engineering)",
@@ -34,59 +35,47 @@
34
35
  "import": "./dist/index.js",
35
36
  "types": "./dist/index.d.ts"
36
37
  },
37
- "./schemas": {
38
- "import": "./dist/schemas/index.js",
39
- "types": "./dist/schemas/index.d.ts"
38
+ "./extractor": {
39
+ "import": "./dist/extractor.js",
40
+ "types": "./dist/extractor.d.ts"
40
41
  },
41
- "./generators": {
42
- "import": "./dist/generators/index.js",
43
- "types": "./dist/generators/index.d.ts"
42
+ "./optimizer": {
43
+ "import": "./dist/optimizer.js",
44
+ "types": "./dist/optimizer.d.ts"
44
45
  },
45
- "./geo": {
46
- "import": "./dist/geo/index.js",
47
- "types": "./dist/geo/index.d.ts"
46
+ "./auditor": {
47
+ "import": "./dist/auditor.js",
48
+ "types": "./dist/auditor.d.ts"
48
49
  }
49
50
  },
50
51
  "main": "./dist/index.js",
51
52
  "module": "./dist/index.js",
52
53
  "types": "./dist/index.d.ts",
54
+ "bin": {
55
+ "geo-semantic-layer": "./dist/cli.js"
56
+ },
53
57
  "files": [
54
58
  "dist",
55
59
  "README.md",
56
- "CHANGELOG.md",
57
- "LICENSE"
60
+ "CHANGELOG.md"
58
61
  ],
59
62
  "scripts": {
60
63
  "build": "tsup",
61
64
  "dev": "tsup --watch",
62
65
  "clean": "rm -rf dist *.tsbuildinfo",
63
- "test": "vitest run",
64
- "test:watch": "vitest",
65
- "test:coverage": "vitest run --coverage",
66
- "typecheck": "tsc --noEmit",
67
- "lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .",
68
- "lint:fix": "eslint --cache --cache-location ./node_modules/.cache/eslint . --fix",
69
- "format": "prettier --write \"**/*.{ts,md,json}\"",
70
- "format:check": "prettier --check \"**/*.{ts,md,json}\"",
71
- "prepublishOnly": "npm run build"
66
+ "test": "echo 'Tests run from individual packages'",
67
+ "typecheck": "tsc --noEmit"
72
68
  },
73
69
  "dependencies": {
74
- "zod": "^3.22.4"
70
+ "@semantic-layer/auditor": "workspace:*",
71
+ "@semantic-layer/cli": "workspace:*",
72
+ "@semantic-layer/core": "workspace:*",
73
+ "@semantic-layer/extractor": "workspace:*",
74
+ "@semantic-layer/optimizer": "workspace:*"
75
75
  },
76
76
  "devDependencies": {
77
- "@types/node": "^20.11.5",
78
- "@typescript-eslint/eslint-plugin": "^6.19.0",
79
- "@typescript-eslint/parser": "^6.19.0",
80
- "@vitest/coverage-v8": "^1.2.1",
81
- "@vitest/ui": "^1.2.1",
82
- "eslint": "^8.56.0",
83
- "eslint-config-prettier": "^9.1.0",
84
- "eslint-plugin-import": "^2.29.1",
85
- "prettier": "^3.2.4",
86
77
  "tsup": "^8.0.1",
87
- "typescript": "^5.7.2",
88
- "vite": "^5.0.12",
89
- "vitest": "^1.2.1"
78
+ "typescript": "^5.7.2"
90
79
  },
91
80
  "publishConfig": {
92
81
  "access": "public"
package/CHANGELOG.md DELETED
@@ -1,61 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- ## [2.0.2] - 2026-01-07
6
-
7
- ### 🎉 Initial Public Release
8
-
9
- First public release of **GEO Semantic Layer** - Framework-agnostic TypeScript library for Generative Engine Optimization (GEO) and structured data automation.
10
-
11
- #### ✨ Features
12
-
13
- - **Pure Functions** - Framework-agnostic generator functions for all major Schema.org types
14
- - **Zero Framework Dependencies** - Only Zod for runtime validation
15
- - **Universal Compatibility** - Works in Node.js, Deno, Bun, browsers, edge runtimes, and any JavaScript environment
16
- - **Full TypeScript Support** - Complete type safety with TypeScript 5.0+
17
- - **GEO Optimization** - Built-in features for Generative Engine Optimization:
18
- - Hallucination Guard - Entity validation against authoritative sources
19
- - Content Density Engine - Automatic optimization for LLM context windows
20
- - **Multiple Entry Points** - Modular exports for schemas, generators, and GEO engine
21
- - **Tiny Bundle** - ~10KB gzipped with only Zod as dependency
22
-
23
- #### 📦 Available Generators
24
-
25
- - `generateOrganizationSchema()` - Company/business information
26
- - `generatePersonSchema()` - Individual person profiles
27
- - `generateProductSchema()` - E-commerce products with ratings
28
- - `generateArticleSchema()` - Blog posts and articles
29
- - `generateFAQSchema()` - Frequently asked questions
30
- - `generateBreadcrumbSchema()` - Navigation breadcrumbs
31
- - `generateLocalBusinessSchema()` - Physical business locations
32
- - `generateEventSchema()` - Events and conferences
33
- - `generateWebPageSchema()` - Individual web pages
34
-
35
- #### 🎯 Framework Integration
36
-
37
- Works seamlessly with:
38
- - React / Next.js
39
- - Vue 3 / Nuxt
40
- - Svelte / SvelteKit
41
- - Astro
42
- - Angular
43
- - Node.js / Express
44
- - Vanilla JavaScript
45
-
46
- #### 📚 Package Structure
47
-
48
- ```
49
- geo-semantic-layer/
50
- ├── schemas/ # Zod validation schemas
51
- ├── generators/ # Pure generator functions
52
- └── geo/ # GEO optimization engine
53
- ```
54
-
55
- ---
56
-
57
- ## Links
58
-
59
- - [npm](https://www.npmjs.com/package/geo-semantic-layer)
60
- - [GitHub](https://github.com/bdovenbird/semantic-layer)
61
- - [Issues](https://github.com/bdovenbird/semantic-layer/issues)
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Rafael Calderón (BDOvenbird Engineering)
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.