@voicenter-team/nuxt-llms-generator 0.1.9 โ 0.1.11
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 +625 -625
- package/dist/chunks/llms-files-generator.mjs +313 -115
- package/dist/module.json +1 -1
- package/package.json +63 -63
package/README.md
CHANGED
|
@@ -1,625 +1,625 @@
|
|
|
1
|
-
# ๐ค LLMS Documentation Generator for Nuxt 3
|
|
2
|
-
|
|
3
|
-
**Transform your Umbraco CMS content into AI-optimized documentation following the 2024 LLMS.txt standard**
|
|
4
|
-
|
|
5
|
-
[](https://typescript.org)
|
|
6
|
-
[](https://nuxt.com)
|
|
7
|
-
[](https://claude.ai)
|
|
8
|
-
[](LICENSE)
|
|
9
|
-
|
|
10
|
-
Generate high-quality, AI-optimized markdown documentation from your Umbraco CMS content using Claude AI. Perfect for creating LLMS.txt files that help AI systems understand your website.
|
|
11
|
-
|
|
12
|
-
## ๐ How It Works
|
|
13
|
-
|
|
14
|
-
```mermaid
|
|
15
|
-
flowchart TB
|
|
16
|
-
subgraph "INPUT"
|
|
17
|
-
JSON[UmbracoData.json<br/>๐ CMS Content]
|
|
18
|
-
CONFIG[nuxt.config.ts<br/>โ๏ธ Configuration]
|
|
19
|
-
API_KEY[๐ Anthropic API Key]
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
subgraph "PROCESSING PIPELINE"
|
|
23
|
-
START([๐ Build Process Starts])
|
|
24
|
-
|
|
25
|
-
subgraph "1๏ธโฃ INITIALIZATION"
|
|
26
|
-
LOAD[Load Configuration]
|
|
27
|
-
VALIDATE[Validate API Connection]
|
|
28
|
-
CACHE_CHECK[Check Template Cache]
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
subgraph "2๏ธโฃ CONTENT ANALYSIS"
|
|
32
|
-
FILTER[Filter Visible Pages<br/>๐ Skip hidePage: "1"]
|
|
33
|
-
EXTRACT[Extract Page Content<br/>๐ JSONPath Resolution]
|
|
34
|
-
HASH[Generate Structure Hash<br/>๐๏ธ Detect Changes]
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
subgraph "3๏ธโฃ TEMPLATE GENERATION"
|
|
38
|
-
CACHE_HIT{Cache Hit?}
|
|
39
|
-
CLAUDE[๐ค Claude AI Analysis<br/>Semantic Understanding]
|
|
40
|
-
TEMPLATE[Generate Mustache Template<br/>๐ AI-Optimized Structure]
|
|
41
|
-
STORE_CACHE[๐พ Store in Cache]
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
subgraph "4๏ธโฃ CLEANUP & OPTIMIZATION"
|
|
45
|
-
CLEANUP[๐งน Orphaned Template Cleanup<br/>Remove deleted/hidden pages]
|
|
46
|
-
HTML_CLEAN[๐ง HTML-to-Markdown<br/>Clean Artifacts & Entities]
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
subgraph "5๏ธโฃ FILE GENERATION"
|
|
50
|
-
RENDER[Render Templates<br/>๐จ Mustache + Data]
|
|
51
|
-
POST_PROCESS[Post-Process Markdown<br/>โจ Final Quality Pass]
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
subgraph "OUTPUT FILES"
|
|
56
|
-
LLMS_TXT[๐ llms.txt<br/>Navigation Index]
|
|
57
|
-
LLMS_FULL[๐ llms-full.txt<br/>Complete Documentation]
|
|
58
|
-
MD_FILES[๐ Individual .md Files<br/>Per-Page Documentation]
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
subgraph "MULTI-SITE SUPPORT"
|
|
62
|
-
ENV1[๐ Site 1<br/>SITE_ENV=main]
|
|
63
|
-
ENV2[๐ Site 2<br/>SITE_ENV=partner]
|
|
64
|
-
ENV3[๐ Site 3<br/>SITE_ENV=staging]
|
|
65
|
-
|
|
66
|
-
CACHE1[๐พ .llms-templates/main/]
|
|
67
|
-
CACHE2[๐พ .llms-templates/partner/]
|
|
68
|
-
CACHE3[๐พ .llms-templates/staging/]
|
|
69
|
-
|
|
70
|
-
OUT1[๐ .output/llms/main/]
|
|
71
|
-
OUT2[๐ .output/llms/partner/]
|
|
72
|
-
OUT3[๐ .output/llms/staging/]
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
%% Flow connections
|
|
76
|
-
JSON --> START
|
|
77
|
-
CONFIG --> START
|
|
78
|
-
API_KEY --> START
|
|
79
|
-
|
|
80
|
-
START --> LOAD
|
|
81
|
-
LOAD --> VALIDATE
|
|
82
|
-
VALIDATE --> CACHE_CHECK
|
|
83
|
-
|
|
84
|
-
CACHE_CHECK --> FILTER
|
|
85
|
-
FILTER --> EXTRACT
|
|
86
|
-
EXTRACT --> HASH
|
|
87
|
-
|
|
88
|
-
HASH --> CACHE_HIT
|
|
89
|
-
CACHE_HIT -->|โ No| CLAUDE
|
|
90
|
-
CACHE_HIT -->|โ
Yes| CLEANUP
|
|
91
|
-
|
|
92
|
-
CLAUDE --> TEMPLATE
|
|
93
|
-
TEMPLATE --> STORE_CACHE
|
|
94
|
-
STORE_CACHE --> CLEANUP
|
|
95
|
-
|
|
96
|
-
CLEANUP --> HTML_CLEAN
|
|
97
|
-
HTML_CLEAN --> RENDER
|
|
98
|
-
RENDER --> POST_PROCESS
|
|
99
|
-
|
|
100
|
-
POST_PROCESS --> LLMS_TXT
|
|
101
|
-
POST_PROCESS --> LLMS_FULL
|
|
102
|
-
POST_PROCESS --> MD_FILES
|
|
103
|
-
|
|
104
|
-
%% Multi-site flows
|
|
105
|
-
CONFIG -.-> ENV1
|
|
106
|
-
CONFIG -.-> ENV2
|
|
107
|
-
CONFIG -.-> ENV3
|
|
108
|
-
|
|
109
|
-
ENV1 -.-> CACHE1
|
|
110
|
-
ENV2 -.-> CACHE2
|
|
111
|
-
ENV3 -.-> CACHE3
|
|
112
|
-
|
|
113
|
-
CACHE1 -.-> OUT1
|
|
114
|
-
CACHE2 -.-> OUT2
|
|
115
|
-
CACHE3 -.-> OUT3
|
|
116
|
-
|
|
117
|
-
%% Styling
|
|
118
|
-
classDef input fill:#e1f5fe
|
|
119
|
-
classDef process fill:#f3e5f5
|
|
120
|
-
classDef output fill:#e8f5e8
|
|
121
|
-
classDef multisite fill:#fff3e0
|
|
122
|
-
|
|
123
|
-
class JSON,CONFIG,API_KEY input
|
|
124
|
-
class LLMS_TXT,LLMS_FULL,MD_FILES output
|
|
125
|
-
class ENV1,ENV2,ENV3,CACHE1,CACHE2,CACHE3,OUT1,OUT2,OUT3 multisite
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### ๐ฏ **Key Process Details**
|
|
129
|
-
|
|
130
|
-
| Phase | What Happens | Why It Matters |
|
|
131
|
-
|--------------------------|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------|
|
|
132
|
-
| **๐ Content Analysis** | Filters visible pages, extracts content via JSONPath, generates structure hashes | Only processes public pages, detects actual changes (not just content updates) |
|
|
133
|
-
| **๐ค AI Generation** | Claude analyzes page structure and generates semantic Mustache templates | Creates context-aware templates that understand your business domain |
|
|
134
|
-
| **๐พ Smart Caching** | Stores templates with structure hashes, reuses unchanged templates | Saves API costs and generation time on subsequent builds |
|
|
135
|
-
| **๐งน Automatic Cleanup** | Removes templates for deleted/hidden pages, syncs with current content | Prevents cache bloat and maintains accuracy |
|
|
136
|
-
| **๐ง Post-Processing** | Converts HTML to clean markdown, removes artifacts and entities | Ensures AI-optimized output that follows 2024 LLMS.txt standards |
|
|
137
|
-
|
|
138
|
-
### ๐ข **Multi-Site Architecture**
|
|
139
|
-
|
|
140
|
-
The system automatically adapts to different environments using the `SITE_ENV` variable:
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
SITE_ENV=main โ UmbracoData-main.json โ .llms-templates/main/ โ .output/llms/main/
|
|
144
|
-
SITE_ENV=partner โ UmbracoData-partner.json โ .llms-templates/partner/ โ .output/llms/partner/
|
|
145
|
-
SITE_ENV=staging โ UmbracoData-staging.json โ .llms-templates/staging/ โ .output/llms/staging/
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
Each environment maintains its own isolated cache and output, preventing conflicts while sharing the same codebase and configuration logic.
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
## ๐ Features
|
|
153
|
-
|
|
154
|
-
### ๐ค **AI-Powered Template Generation**
|
|
155
|
-
- **Claude API Integration**: Uses Anthropic's Claude for intelligent content analysis
|
|
156
|
-
- **2024 LLMS.txt Compliance**: Follows the latest LLMS.txt standard for AI consumption
|
|
157
|
-
- **Semantic Understanding**: Automatically detects content types and generates appropriate templates
|
|
158
|
-
- **Multi-language Support**: Handles Hebrew/English mixed content and RTL text
|
|
159
|
-
|
|
160
|
-
### โก **Smart Caching System**
|
|
161
|
-
- **Structure-Based Detection**: Only regenerates when page structure changes (not content values)
|
|
162
|
-
- **Incremental Updates**: Process only changed pages for faster builds
|
|
163
|
-
- **API Cost Optimization**: Avoids unnecessary Claude API calls
|
|
164
|
-
- **Git-Friendly**: Templates stored in git, outputs excluded
|
|
165
|
-
|
|
166
|
-
### ๐งน **Automatic Cleanup**
|
|
167
|
-
- **Orphaned Template Detection**: Removes templates for deleted pages
|
|
168
|
-
- **Hidden Page Handling**: Cleans up templates for pages marked as hidden
|
|
169
|
-
- **Cache Synchronization**: Keeps template cache aligned with Umbraco content
|
|
170
|
-
|
|
171
|
-
### ๐ **Multiple Output Formats**
|
|
172
|
-
1. **`llms.txt`** - Navigation index following 2024 standard
|
|
173
|
-
2. **`llms-full.txt`** - Complete site documentation in one file
|
|
174
|
-
3. **Individual `.md` files** - Clean, AI-optimized markdown per page
|
|
175
|
-
|
|
176
|
-
### ๐ฏ **Production Ready**
|
|
177
|
-
- **26 Passing Tests**: Comprehensive test coverage
|
|
178
|
-
- **TypeScript Support**: Full type safety throughout
|
|
179
|
-
- **Parallel Processing**: Configurable concurrency for large sites
|
|
180
|
-
- **Error Resilience**: Graceful handling of failures with detailed logging
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
## ๐ Quick Start
|
|
185
|
-
|
|
186
|
-
### Installation
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
npm install nuxt-llms-generator
|
|
190
|
-
# or
|
|
191
|
-
yarn add nuxt-llms-generator
|
|
192
|
-
# or
|
|
193
|
-
pnpm add nuxt-llms-generator
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Basic Configuration
|
|
197
|
-
|
|
198
|
-
```typescript
|
|
199
|
-
// nuxt.config.ts
|
|
200
|
-
export default defineNuxtConfig({
|
|
201
|
-
modules: ['nuxt-llms-generator'],
|
|
202
|
-
llmsGenerator: {
|
|
203
|
-
anthropicApiKey: process.env.ANTHROPIC_API_KEY,
|
|
204
|
-
umbracoDataPath: './public/UmbracoData.json',
|
|
205
|
-
finalOutputDir: './.output/llms'
|
|
206
|
-
}
|
|
207
|
-
})
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Environment Variables
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
# .env
|
|
214
|
-
ANTHROPIC_API_KEY=sk-ant-api03-your-key-here
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### Generate Documentation
|
|
218
|
-
|
|
219
|
-
```bash
|
|
220
|
-
npm run build
|
|
221
|
-
# Documentation generated automatically during build process
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
---
|
|
225
|
-
|
|
226
|
-
## โ๏ธ Configuration Options
|
|
227
|
-
|
|
228
|
-
### Core Settings
|
|
229
|
-
|
|
230
|
-
| Option | Type | Required | Default | Description |
|
|
231
|
-
|----------------------|----------|----------|------------------|--------------------------------------------|
|
|
232
|
-
| `anthropicApiKey` | `string` | โ
| - | Your Claude API key from Anthropic |
|
|
233
|
-
| `umbracoDataPath` | `string` | โ
| - | Path to your UmbracoData.json file |
|
|
234
|
-
| `templatesDir` | `string` | โ | `./.llms-templates` | Directory for templates and cache files |
|
|
235
|
-
| `finalOutputDir` | `string` | โ | `./.output/llms` | Output directory for final documentation |
|
|
236
|
-
|
|
237
|
-
### Generation Options
|
|
238
|
-
|
|
239
|
-
| Option | Type | Default | Description |
|
|
240
|
-
|------------------------|-----------|------------------------------|------------------------------------------|
|
|
241
|
-
| `enableIndividualMd` | `boolean` | `true` | Generate individual .md files per page |
|
|
242
|
-
| `enableLLMSFullTxt` | `boolean` | `true` | Generate combined llms-full.txt file |
|
|
243
|
-
| `enableHtmlToMarkdown` | `boolean` | `true` | Convert HTML content to markdown using [node-html-markdown](https://www.npmjs.com/package/node-html-markdown) |
|
|
244
|
-
| `maxConcurrent` | `number` | `5` | Maximum concurrent API requests |
|
|
245
|
-
| `anthropicModel` | `string` | `claude-3-5-sonnet-20241022` | Claude model to use |
|
|
246
|
-
|
|
247
|
-
### Cleanup Options
|
|
248
|
-
|
|
249
|
-
| Option | Type | Default | Description |
|
|
250
|
-
|---------------------|-----------|---------|----------------------------------------|
|
|
251
|
-
| `enableAutoCleanup` | `boolean` | `true` | Automatically clean orphaned templates |
|
|
252
|
-
| `cleanupOrphaned` | `boolean` | `true` | Remove templates for deleted pages |
|
|
253
|
-
| `cleanupHidden` | `boolean` | `true` | Remove templates for hidden pages |
|
|
254
|
-
|
|
255
|
-
---
|
|
256
|
-
|
|
257
|
-
## ๐ข Multi-Site Implementation
|
|
258
|
-
|
|
259
|
-
Perfect for projects where one codebase generates multiple websites based on environment variables.
|
|
260
|
-
|
|
261
|
-
### Environment-Based Configuration
|
|
262
|
-
|
|
263
|
-
```typescript
|
|
264
|
-
// nuxt.config.ts
|
|
265
|
-
const siteEnv = process.env.SITE_ENV || 'main' // 'main', 'staging', 'partner', etc.
|
|
266
|
-
|
|
267
|
-
export default defineNuxtConfig({
|
|
268
|
-
modules: ['nuxt-llms-generator'],
|
|
269
|
-
llmsGenerator: {
|
|
270
|
-
anthropicApiKey: process.env.ANTHROPIC_API_KEY,
|
|
271
|
-
|
|
272
|
-
// Environment-specific paths
|
|
273
|
-
umbracoDataPath: `./public/UmbracoData-${siteEnv}.json`,
|
|
274
|
-
templatesDir: `./.llms-templates/${siteEnv}`,
|
|
275
|
-
finalOutputDir: `./.output/llms/${siteEnv}`,
|
|
276
|
-
|
|
277
|
-
// Shared settings
|
|
278
|
-
maxConcurrent: 5,
|
|
279
|
-
enableAutoCleanup: true
|
|
280
|
-
}
|
|
281
|
-
})
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
### Build Commands
|
|
285
|
-
|
|
286
|
-
```json
|
|
287
|
-
// package.json
|
|
288
|
-
{
|
|
289
|
-
"scripts": {
|
|
290
|
-
"build:main": "SITE_ENV=main nuxt build",
|
|
291
|
-
"build:partner": "SITE_ENV=partner nuxt build",
|
|
292
|
-
"build:staging": "SITE_ENV=staging nuxt build"
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
### Directory Structure
|
|
298
|
-
|
|
299
|
-
```
|
|
300
|
-
project/
|
|
301
|
-
โโโ .llms-templates/
|
|
302
|
-
โ โโโ main/ # Main site templates & cache
|
|
303
|
-
โ โโโ partner/ # Partner site templates & cache
|
|
304
|
-
โ โโโ staging/ # Staging site templates & cache
|
|
305
|
-
โโโ .output/
|
|
306
|
-
โ โโโ llms/
|
|
307
|
-
โ โโโ main/ # Main site docs
|
|
308
|
-
โ โโโ partner/ # Partner site docs
|
|
309
|
-
โ โโโ staging/ # Staging site docs
|
|
310
|
-
โโโ public/
|
|
311
|
-
โ โโโ UmbracoData-main.json
|
|
312
|
-
โ โโโ UmbracoData-partner.json
|
|
313
|
-
โ โโโ UmbracoData-staging.json
|
|
314
|
-
โโโ templates/
|
|
315
|
-
โโโ main/ # Main site templates
|
|
316
|
-
โโโ partner/ # Partner site templates
|
|
317
|
-
โโโ staging/ # Staging site templates
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
---
|
|
321
|
-
|
|
322
|
-
## ๐ Generated Output Examples
|
|
323
|
-
|
|
324
|
-
### `llms.txt` (Navigation Index)
|
|
325
|
-
```markdown
|
|
326
|
-
# Business Communication Solutions | Voicenter
|
|
327
|
-
|
|
328
|
-
> Thousands of organizations in Israel manage their business communications through our advanced cloud platform
|
|
329
|
-
|
|
330
|
-
This website contains comprehensive information about business communication solutions. The content is organized into the following sections:
|
|
331
|
-
|
|
332
|
-
## Services
|
|
333
|
-
|
|
334
|
-
- [Call Center Solutions](call-center-solutions.md): Complete call center management tools
|
|
335
|
-
- [Smart PBX for Business](smart-pbx-business.md): Advanced business telephony services
|
|
336
|
-
- [Mobile Solutions](mobile-solutions.md): Unlimited mobile communication solutions
|
|
337
|
-
|
|
338
|
-
## Technical
|
|
339
|
-
|
|
340
|
-
- [API Integration](api-integration.md): Developer tools and API documentation
|
|
341
|
-
- [CRM Connectivity](crm-connectivity.md): Full CRM integration capabilities
|
|
342
|
-
|
|
343
|
-
## Optional
|
|
344
|
-
|
|
345
|
-
- [Complete Documentation](llms-full.txt): All content combined in a single file
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
### Individual `.md` Files
|
|
349
|
-
```markdown
|
|
350
|
-
# Call Center Solutions
|
|
351
|
-
|
|
352
|
-
> Complete call center management tools for modern businesses
|
|
353
|
-
|
|
354
|
-
## Overview
|
|
355
|
-
|
|
356
|
-
Our call center solutions provide comprehensive tools for managing customer communications efficiently. Built on advanced cloud technology, these tools enable seamless implementation and superior organizational management.
|
|
357
|
-
|
|
358
|
-
## Key Features
|
|
359
|
-
|
|
360
|
-
- **Advanced Queue Management**: Intelligent call routing and distribution
|
|
361
|
-
- **Automated Callbacks**: Smart callback scheduling system
|
|
362
|
-
- **CRM Integration**: Seamless connection with existing CRM systems
|
|
363
|
-
- **Real-time Analytics**: Live monitoring and performance dashboards
|
|
364
|
-
- **Multi-channel Support**: Handle calls, emails, and chat in one platform
|
|
365
|
-
|
|
366
|
-
## Benefits
|
|
367
|
-
|
|
368
|
-
- Reduced customer wait times
|
|
369
|
-
- Increased agent productivity
|
|
370
|
-
- Better customer satisfaction scores
|
|
371
|
-
- Scalable solution that grows with your business
|
|
372
|
-
|
|
373
|
-
*Generated with Claude AI | Last updated: 2024-01-16*
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
---
|
|
377
|
-
|
|
378
|
-
## ๐ง Advanced Usage
|
|
379
|
-
|
|
380
|
-
### Custom Build Script
|
|
381
|
-
|
|
382
|
-
```javascript
|
|
383
|
-
// scripts/generate-docs.js
|
|
384
|
-
import { LLMSFilesGenerator } from 'nuxt-llms-generator'
|
|
385
|
-
|
|
386
|
-
const config = {
|
|
387
|
-
anthropicApiKey: process.env.ANTHROPIC_API_KEY,
|
|
388
|
-
umbracoDataPath: './public/UmbracoData.json',
|
|
389
|
-
finalOutputDir: './docs/ai-generated'
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
const generator = new LLMSFilesGenerator(config)
|
|
393
|
-
|
|
394
|
-
try {
|
|
395
|
-
const files = await generator.generateAllFiles()
|
|
396
|
-
console.log(`โ
Generated ${files.individualMdFiles?.length || 0} markdown files`)
|
|
397
|
-
console.log('๐ LLMS documentation generation complete!')
|
|
398
|
-
} catch (error) {
|
|
399
|
-
console.error('โ Generation failed:', error)
|
|
400
|
-
process.exit(1)
|
|
401
|
-
}
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
### Development vs Production
|
|
405
|
-
|
|
406
|
-
```typescript
|
|
407
|
-
// nuxt.config.ts
|
|
408
|
-
const isDev = process.env.NODE_ENV === 'development'
|
|
409
|
-
|
|
410
|
-
export default defineNuxtConfig({
|
|
411
|
-
llmsGenerator: {
|
|
412
|
-
anthropicApiKey: process.env.ANTHROPIC_API_KEY,
|
|
413
|
-
umbracoDataPath: './public/UmbracoData.json',
|
|
414
|
-
|
|
415
|
-
// Generate fewer files during development
|
|
416
|
-
enableIndividualMd: !isDev,
|
|
417
|
-
enableLLMSFullTxt: !isDev,
|
|
418
|
-
|
|
419
|
-
// Lower concurrency in development
|
|
420
|
-
maxConcurrent: isDev ? 2 : 8
|
|
421
|
-
}
|
|
422
|
-
})
|
|
423
|
-
```
|
|
424
|
-
|
|
425
|
-
### CI/CD Integration
|
|
426
|
-
|
|
427
|
-
```yaml
|
|
428
|
-
# .github/workflows/build.yml
|
|
429
|
-
name: Generate Documentation
|
|
430
|
-
on:
|
|
431
|
-
push:
|
|
432
|
-
branches: [main]
|
|
433
|
-
|
|
434
|
-
jobs:
|
|
435
|
-
docs:
|
|
436
|
-
runs-on: ubuntu-latest
|
|
437
|
-
steps:
|
|
438
|
-
- uses: actions/checkout@v3
|
|
439
|
-
- uses: actions/setup-node@v3
|
|
440
|
-
with:
|
|
441
|
-
node-version: 18
|
|
442
|
-
- run: npm ci
|
|
443
|
-
- run: npm run build
|
|
444
|
-
env:
|
|
445
|
-
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
446
|
-
- name: Deploy docs
|
|
447
|
-
run: cp -r .output/llms/* ./public/docs/
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
---
|
|
451
|
-
|
|
452
|
-
## ๐งช Testing
|
|
453
|
-
|
|
454
|
-
Run the comprehensive test suite:
|
|
455
|
-
|
|
456
|
-
```bash
|
|
457
|
-
npm test
|
|
458
|
-
# or
|
|
459
|
-
npm run test:watch # Watch mode
|
|
460
|
-
```
|
|
461
|
-
|
|
462
|
-
### Test Coverage
|
|
463
|
-
|
|
464
|
-
- โ
Template generation and caching
|
|
465
|
-
- โ
HTML-to-markdown conversion
|
|
466
|
-
- โ
Multi-language content handling
|
|
467
|
-
- โ
Page visibility filtering
|
|
468
|
-
- โ
Orphaned template cleanup
|
|
469
|
-
- โ
Configuration validation
|
|
470
|
-
- โ
Error handling and resilience
|
|
471
|
-
|
|
472
|
-
---
|
|
473
|
-
|
|
474
|
-
## ๐ Troubleshooting
|
|
475
|
-
|
|
476
|
-
### Common Issues
|
|
477
|
-
|
|
478
|
-
**โ "Claude API key not found"**
|
|
479
|
-
```bash
|
|
480
|
-
# Make sure your API key is set
|
|
481
|
-
echo $ANTHROPIC_API_KEY
|
|
482
|
-
# Should show: sk-ant-api03-...
|
|
483
|
-
```
|
|
484
|
-
|
|
485
|
-
**โ "UmbracoData.json not found"**
|
|
486
|
-
```bash
|
|
487
|
-
# Check the file exists
|
|
488
|
-
ls -la public/UmbracoData.json
|
|
489
|
-
# Verify path in nuxt.config.ts matches
|
|
490
|
-
```
|
|
491
|
-
|
|
492
|
-
**โ "Template generation failed"**
|
|
493
|
-
- Check Claude API quota and rate limits
|
|
494
|
-
- Verify UmbracoData.json has valid structure
|
|
495
|
-
- Enable debug logging: `DEBUG=llms:* npm run build`
|
|
496
|
-
|
|
497
|
-
### Performance Tips
|
|
498
|
-
|
|
499
|
-
1. **Large Sites (1000+ pages)**:
|
|
500
|
-
```typescript
|
|
501
|
-
{
|
|
502
|
-
maxConcurrent: 8, // Higher concurrency
|
|
503
|
-
enableAutoCleanup: true, // Keep cache clean
|
|
504
|
-
}
|
|
505
|
-
```
|
|
506
|
-
|
|
507
|
-
2. **Development Speed**:
|
|
508
|
-
```typescript
|
|
509
|
-
{
|
|
510
|
-
enableIndividualMd: false, // Skip individual files
|
|
511
|
-
maxConcurrent: 2, // Lower API usage
|
|
512
|
-
}
|
|
513
|
-
```
|
|
514
|
-
|
|
515
|
-
3. **Production Optimization**:
|
|
516
|
-
```typescript
|
|
517
|
-
{
|
|
518
|
-
enableAutoCleanup: true,
|
|
519
|
-
cleanupOrphaned: true,
|
|
520
|
-
cleanupHidden: true,
|
|
521
|
-
enableHtmlToMarkdown: true // Clean HTML from CMS content
|
|
522
|
-
}
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
4. **HTML Content Processing**:
|
|
526
|
-
```typescript
|
|
527
|
-
{
|
|
528
|
-
enableHtmlToMarkdown: true, // Convert <p>, <h1>, etc. to clean markdown
|
|
529
|
-
enableHtmlToMarkdown: false // Keep HTML as-is (if AI already generates clean content)
|
|
530
|
-
}
|
|
531
|
-
```
|
|
532
|
-
|
|
533
|
-
---
|
|
534
|
-
|
|
535
|
-
## ๐ API Reference
|
|
536
|
-
|
|
537
|
-
### LLMSFilesGenerator
|
|
538
|
-
|
|
539
|
-
```typescript
|
|
540
|
-
import { LLMSFilesGenerator } from 'nuxt-llms-generator'
|
|
541
|
-
|
|
542
|
-
const generator = new LLMSFilesGenerator({
|
|
543
|
-
anthropicApiKey: 'your-api-key',
|
|
544
|
-
umbracoDataPath: './data.json',
|
|
545
|
-
finalOutputDir: './output'
|
|
546
|
-
})
|
|
547
|
-
|
|
548
|
-
// Generate all documentation files
|
|
549
|
-
const files = await generator.generateAllFiles()
|
|
550
|
-
|
|
551
|
-
// Test Claude API connection
|
|
552
|
-
const isConnected = await generator.testConnection()
|
|
553
|
-
|
|
554
|
-
// Clear template cache
|
|
555
|
-
generator.clearCache()
|
|
556
|
-
|
|
557
|
-
// Get generation statistics
|
|
558
|
-
const stats = generator.getStats()
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
### Configuration Interface
|
|
562
|
-
|
|
563
|
-
```typescript
|
|
564
|
-
interface LLMSConfig {
|
|
565
|
-
// Required
|
|
566
|
-
anthropicApiKey: string;
|
|
567
|
-
umbracoDataPath: string;
|
|
568
|
-
|
|
569
|
-
// Optional with defaults
|
|
570
|
-
templatesDir?: string; // './.llms-templates'
|
|
571
|
-
finalOutputDir?: string; // './.output/llms'
|
|
572
|
-
anthropicModel?: string; // 'claude-3-5-sonnet-20241022'
|
|
573
|
-
maxConcurrent?: number; // 5
|
|
574
|
-
enableLLMSFullTxt?: boolean; // true
|
|
575
|
-
enableIndividualMd?: boolean; // true
|
|
576
|
-
enableHtmlToMarkdown?: boolean; // true
|
|
577
|
-
enableAutoCleanup?: boolean; // true
|
|
578
|
-
cleanupOrphaned?: boolean; // true
|
|
579
|
-
cleanupHidden?: boolean; // true
|
|
580
|
-
}
|
|
581
|
-
```
|
|
582
|
-
|
|
583
|
-
---
|
|
584
|
-
|
|
585
|
-
## ๐ค Contributing
|
|
586
|
-
|
|
587
|
-
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
588
|
-
|
|
589
|
-
### Development Setup
|
|
590
|
-
|
|
591
|
-
```bash
|
|
592
|
-
git clone https://github.com/your-org/nuxt-llms-generator.git
|
|
593
|
-
cd nuxt-llms-generator
|
|
594
|
-
npm install
|
|
595
|
-
npm run dev
|
|
596
|
-
```
|
|
597
|
-
|
|
598
|
-
### Running Tests
|
|
599
|
-
|
|
600
|
-
```bash
|
|
601
|
-
npm test # Run all tests
|
|
602
|
-
npm run test:watch # Watch mode
|
|
603
|
-
npm run test:coverage # Coverage report
|
|
604
|
-
```
|
|
605
|
-
|
|
606
|
-
---
|
|
607
|
-
|
|
608
|
-
## ๐ License
|
|
609
|
-
|
|
610
|
-
MIT License - see [LICENSE](LICENSE) file for details.
|
|
611
|
-
|
|
612
|
-
---
|
|
613
|
-
|
|
614
|
-
## ๐ Acknowledgments
|
|
615
|
-
|
|
616
|
-
- [Anthropic](https://anthropic.com) for Claude AI API
|
|
617
|
-
- [Jeremy Howard](https://github.com/jph00) for the 2024 LLMS.txt standard
|
|
618
|
-
- [Nuxt 3](https://nuxt.com) for the amazing framework
|
|
619
|
-
- The open-source community for inspiration and feedback
|
|
620
|
-
|
|
621
|
-
---
|
|
622
|
-
|
|
623
|
-
**Made with โค๏ธ for the AI-first web**
|
|
624
|
-
|
|
625
|
-
Transform your CMS content into AI-optimized documentation that helps AI systems understand your business better.
|
|
1
|
+
# ๐ค LLMS Documentation Generator for Nuxt 3
|
|
2
|
+
|
|
3
|
+
**Transform your Umbraco CMS content into AI-optimized documentation following the 2024 LLMS.txt standard**
|
|
4
|
+
|
|
5
|
+
[](https://typescript.org)
|
|
6
|
+
[](https://nuxt.com)
|
|
7
|
+
[](https://claude.ai)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
|
|
10
|
+
Generate high-quality, AI-optimized markdown documentation from your Umbraco CMS content using Claude AI. Perfect for creating LLMS.txt files that help AI systems understand your website.
|
|
11
|
+
|
|
12
|
+
## ๐ How It Works
|
|
13
|
+
|
|
14
|
+
```mermaid
|
|
15
|
+
flowchart TB
|
|
16
|
+
subgraph "INPUT"
|
|
17
|
+
JSON[UmbracoData.json<br/>๐ CMS Content]
|
|
18
|
+
CONFIG[nuxt.config.ts<br/>โ๏ธ Configuration]
|
|
19
|
+
API_KEY[๐ Anthropic API Key]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
subgraph "PROCESSING PIPELINE"
|
|
23
|
+
START([๐ Build Process Starts])
|
|
24
|
+
|
|
25
|
+
subgraph "1๏ธโฃ INITIALIZATION"
|
|
26
|
+
LOAD[Load Configuration]
|
|
27
|
+
VALIDATE[Validate API Connection]
|
|
28
|
+
CACHE_CHECK[Check Template Cache]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
subgraph "2๏ธโฃ CONTENT ANALYSIS"
|
|
32
|
+
FILTER[Filter Visible Pages<br/>๐ Skip hidePage: "1"]
|
|
33
|
+
EXTRACT[Extract Page Content<br/>๐ JSONPath Resolution]
|
|
34
|
+
HASH[Generate Structure Hash<br/>๐๏ธ Detect Changes]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
subgraph "3๏ธโฃ TEMPLATE GENERATION"
|
|
38
|
+
CACHE_HIT{Cache Hit?}
|
|
39
|
+
CLAUDE[๐ค Claude AI Analysis<br/>Semantic Understanding]
|
|
40
|
+
TEMPLATE[Generate Mustache Template<br/>๐ AI-Optimized Structure]
|
|
41
|
+
STORE_CACHE[๐พ Store in Cache]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
subgraph "4๏ธโฃ CLEANUP & OPTIMIZATION"
|
|
45
|
+
CLEANUP[๐งน Orphaned Template Cleanup<br/>Remove deleted/hidden pages]
|
|
46
|
+
HTML_CLEAN[๐ง HTML-to-Markdown<br/>Clean Artifacts & Entities]
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
subgraph "5๏ธโฃ FILE GENERATION"
|
|
50
|
+
RENDER[Render Templates<br/>๐จ Mustache + Data]
|
|
51
|
+
POST_PROCESS[Post-Process Markdown<br/>โจ Final Quality Pass]
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
subgraph "OUTPUT FILES"
|
|
56
|
+
LLMS_TXT[๐ llms.txt<br/>Navigation Index]
|
|
57
|
+
LLMS_FULL[๐ llms-full.txt<br/>Complete Documentation]
|
|
58
|
+
MD_FILES[๐ Individual .md Files<br/>Per-Page Documentation]
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
subgraph "MULTI-SITE SUPPORT"
|
|
62
|
+
ENV1[๐ Site 1<br/>SITE_ENV=main]
|
|
63
|
+
ENV2[๐ Site 2<br/>SITE_ENV=partner]
|
|
64
|
+
ENV3[๐ Site 3<br/>SITE_ENV=staging]
|
|
65
|
+
|
|
66
|
+
CACHE1[๐พ .llms-templates/main/]
|
|
67
|
+
CACHE2[๐พ .llms-templates/partner/]
|
|
68
|
+
CACHE3[๐พ .llms-templates/staging/]
|
|
69
|
+
|
|
70
|
+
OUT1[๐ .output/llms/main/]
|
|
71
|
+
OUT2[๐ .output/llms/partner/]
|
|
72
|
+
OUT3[๐ .output/llms/staging/]
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
%% Flow connections
|
|
76
|
+
JSON --> START
|
|
77
|
+
CONFIG --> START
|
|
78
|
+
API_KEY --> START
|
|
79
|
+
|
|
80
|
+
START --> LOAD
|
|
81
|
+
LOAD --> VALIDATE
|
|
82
|
+
VALIDATE --> CACHE_CHECK
|
|
83
|
+
|
|
84
|
+
CACHE_CHECK --> FILTER
|
|
85
|
+
FILTER --> EXTRACT
|
|
86
|
+
EXTRACT --> HASH
|
|
87
|
+
|
|
88
|
+
HASH --> CACHE_HIT
|
|
89
|
+
CACHE_HIT -->|โ No| CLAUDE
|
|
90
|
+
CACHE_HIT -->|โ
Yes| CLEANUP
|
|
91
|
+
|
|
92
|
+
CLAUDE --> TEMPLATE
|
|
93
|
+
TEMPLATE --> STORE_CACHE
|
|
94
|
+
STORE_CACHE --> CLEANUP
|
|
95
|
+
|
|
96
|
+
CLEANUP --> HTML_CLEAN
|
|
97
|
+
HTML_CLEAN --> RENDER
|
|
98
|
+
RENDER --> POST_PROCESS
|
|
99
|
+
|
|
100
|
+
POST_PROCESS --> LLMS_TXT
|
|
101
|
+
POST_PROCESS --> LLMS_FULL
|
|
102
|
+
POST_PROCESS --> MD_FILES
|
|
103
|
+
|
|
104
|
+
%% Multi-site flows
|
|
105
|
+
CONFIG -.-> ENV1
|
|
106
|
+
CONFIG -.-> ENV2
|
|
107
|
+
CONFIG -.-> ENV3
|
|
108
|
+
|
|
109
|
+
ENV1 -.-> CACHE1
|
|
110
|
+
ENV2 -.-> CACHE2
|
|
111
|
+
ENV3 -.-> CACHE3
|
|
112
|
+
|
|
113
|
+
CACHE1 -.-> OUT1
|
|
114
|
+
CACHE2 -.-> OUT2
|
|
115
|
+
CACHE3 -.-> OUT3
|
|
116
|
+
|
|
117
|
+
%% Styling
|
|
118
|
+
classDef input fill:#e1f5fe
|
|
119
|
+
classDef process fill:#f3e5f5
|
|
120
|
+
classDef output fill:#e8f5e8
|
|
121
|
+
classDef multisite fill:#fff3e0
|
|
122
|
+
|
|
123
|
+
class JSON,CONFIG,API_KEY input
|
|
124
|
+
class LLMS_TXT,LLMS_FULL,MD_FILES output
|
|
125
|
+
class ENV1,ENV2,ENV3,CACHE1,CACHE2,CACHE3,OUT1,OUT2,OUT3 multisite
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### ๐ฏ **Key Process Details**
|
|
129
|
+
|
|
130
|
+
| Phase | What Happens | Why It Matters |
|
|
131
|
+
|--------------------------|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------|
|
|
132
|
+
| **๐ Content Analysis** | Filters visible pages, extracts content via JSONPath, generates structure hashes | Only processes public pages, detects actual changes (not just content updates) |
|
|
133
|
+
| **๐ค AI Generation** | Claude analyzes page structure and generates semantic Mustache templates | Creates context-aware templates that understand your business domain |
|
|
134
|
+
| **๐พ Smart Caching** | Stores templates with structure hashes, reuses unchanged templates | Saves API costs and generation time on subsequent builds |
|
|
135
|
+
| **๐งน Automatic Cleanup** | Removes templates for deleted/hidden pages, syncs with current content | Prevents cache bloat and maintains accuracy |
|
|
136
|
+
| **๐ง Post-Processing** | Converts HTML to clean markdown, removes artifacts and entities | Ensures AI-optimized output that follows 2024 LLMS.txt standards |
|
|
137
|
+
|
|
138
|
+
### ๐ข **Multi-Site Architecture**
|
|
139
|
+
|
|
140
|
+
The system automatically adapts to different environments using the `SITE_ENV` variable:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
SITE_ENV=main โ UmbracoData-main.json โ .llms-templates/main/ โ .output/llms/main/
|
|
144
|
+
SITE_ENV=partner โ UmbracoData-partner.json โ .llms-templates/partner/ โ .output/llms/partner/
|
|
145
|
+
SITE_ENV=staging โ UmbracoData-staging.json โ .llms-templates/staging/ โ .output/llms/staging/
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Each environment maintains its own isolated cache and output, preventing conflicts while sharing the same codebase and configuration logic.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## ๐ Features
|
|
153
|
+
|
|
154
|
+
### ๐ค **AI-Powered Template Generation**
|
|
155
|
+
- **Claude API Integration**: Uses Anthropic's Claude for intelligent content analysis
|
|
156
|
+
- **2024 LLMS.txt Compliance**: Follows the latest LLMS.txt standard for AI consumption
|
|
157
|
+
- **Semantic Understanding**: Automatically detects content types and generates appropriate templates
|
|
158
|
+
- **Multi-language Support**: Handles Hebrew/English mixed content and RTL text
|
|
159
|
+
|
|
160
|
+
### โก **Smart Caching System**
|
|
161
|
+
- **Structure-Based Detection**: Only regenerates when page structure changes (not content values)
|
|
162
|
+
- **Incremental Updates**: Process only changed pages for faster builds
|
|
163
|
+
- **API Cost Optimization**: Avoids unnecessary Claude API calls
|
|
164
|
+
- **Git-Friendly**: Templates stored in git, outputs excluded
|
|
165
|
+
|
|
166
|
+
### ๐งน **Automatic Cleanup**
|
|
167
|
+
- **Orphaned Template Detection**: Removes templates for deleted pages
|
|
168
|
+
- **Hidden Page Handling**: Cleans up templates for pages marked as hidden
|
|
169
|
+
- **Cache Synchronization**: Keeps template cache aligned with Umbraco content
|
|
170
|
+
|
|
171
|
+
### ๐ **Multiple Output Formats**
|
|
172
|
+
1. **`llms.txt`** - Navigation index following 2024 standard
|
|
173
|
+
2. **`llms-full.txt`** - Complete site documentation in one file
|
|
174
|
+
3. **Individual `.md` files** - Clean, AI-optimized markdown per page
|
|
175
|
+
|
|
176
|
+
### ๐ฏ **Production Ready**
|
|
177
|
+
- **26 Passing Tests**: Comprehensive test coverage
|
|
178
|
+
- **TypeScript Support**: Full type safety throughout
|
|
179
|
+
- **Parallel Processing**: Configurable concurrency for large sites
|
|
180
|
+
- **Error Resilience**: Graceful handling of failures with detailed logging
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## ๐ Quick Start
|
|
185
|
+
|
|
186
|
+
### Installation
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
npm install nuxt-llms-generator
|
|
190
|
+
# or
|
|
191
|
+
yarn add nuxt-llms-generator
|
|
192
|
+
# or
|
|
193
|
+
pnpm add nuxt-llms-generator
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Basic Configuration
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
// nuxt.config.ts
|
|
200
|
+
export default defineNuxtConfig({
|
|
201
|
+
modules: ['nuxt-llms-generator'],
|
|
202
|
+
llmsGenerator: {
|
|
203
|
+
anthropicApiKey: process.env.ANTHROPIC_API_KEY,
|
|
204
|
+
umbracoDataPath: './public/UmbracoData.json',
|
|
205
|
+
finalOutputDir: './.output/llms'
|
|
206
|
+
}
|
|
207
|
+
})
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Environment Variables
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# .env
|
|
214
|
+
ANTHROPIC_API_KEY=sk-ant-api03-your-key-here
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Generate Documentation
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
npm run build
|
|
221
|
+
# Documentation generated automatically during build process
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## โ๏ธ Configuration Options
|
|
227
|
+
|
|
228
|
+
### Core Settings
|
|
229
|
+
|
|
230
|
+
| Option | Type | Required | Default | Description |
|
|
231
|
+
|----------------------|----------|----------|------------------|--------------------------------------------|
|
|
232
|
+
| `anthropicApiKey` | `string` | โ
| - | Your Claude API key from Anthropic |
|
|
233
|
+
| `umbracoDataPath` | `string` | โ
| - | Path to your UmbracoData.json file |
|
|
234
|
+
| `templatesDir` | `string` | โ | `./.llms-templates` | Directory for templates and cache files |
|
|
235
|
+
| `finalOutputDir` | `string` | โ | `./.output/llms` | Output directory for final documentation |
|
|
236
|
+
|
|
237
|
+
### Generation Options
|
|
238
|
+
|
|
239
|
+
| Option | Type | Default | Description |
|
|
240
|
+
|------------------------|-----------|------------------------------|------------------------------------------|
|
|
241
|
+
| `enableIndividualMd` | `boolean` | `true` | Generate individual .md files per page |
|
|
242
|
+
| `enableLLMSFullTxt` | `boolean` | `true` | Generate combined llms-full.txt file |
|
|
243
|
+
| `enableHtmlToMarkdown` | `boolean` | `true` | Convert HTML content to markdown using [node-html-markdown](https://www.npmjs.com/package/node-html-markdown) |
|
|
244
|
+
| `maxConcurrent` | `number` | `5` | Maximum concurrent API requests |
|
|
245
|
+
| `anthropicModel` | `string` | `claude-3-5-sonnet-20241022` | Claude model to use |
|
|
246
|
+
|
|
247
|
+
### Cleanup Options
|
|
248
|
+
|
|
249
|
+
| Option | Type | Default | Description |
|
|
250
|
+
|---------------------|-----------|---------|----------------------------------------|
|
|
251
|
+
| `enableAutoCleanup` | `boolean` | `true` | Automatically clean orphaned templates |
|
|
252
|
+
| `cleanupOrphaned` | `boolean` | `true` | Remove templates for deleted pages |
|
|
253
|
+
| `cleanupHidden` | `boolean` | `true` | Remove templates for hidden pages |
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## ๐ข Multi-Site Implementation
|
|
258
|
+
|
|
259
|
+
Perfect for projects where one codebase generates multiple websites based on environment variables.
|
|
260
|
+
|
|
261
|
+
### Environment-Based Configuration
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
// nuxt.config.ts
|
|
265
|
+
const siteEnv = process.env.SITE_ENV || 'main' // 'main', 'staging', 'partner', etc.
|
|
266
|
+
|
|
267
|
+
export default defineNuxtConfig({
|
|
268
|
+
modules: ['nuxt-llms-generator'],
|
|
269
|
+
llmsGenerator: {
|
|
270
|
+
anthropicApiKey: process.env.ANTHROPIC_API_KEY,
|
|
271
|
+
|
|
272
|
+
// Environment-specific paths
|
|
273
|
+
umbracoDataPath: `./public/UmbracoData-${siteEnv}.json`,
|
|
274
|
+
templatesDir: `./.llms-templates/${siteEnv}`,
|
|
275
|
+
finalOutputDir: `./.output/llms/${siteEnv}`,
|
|
276
|
+
|
|
277
|
+
// Shared settings
|
|
278
|
+
maxConcurrent: 5,
|
|
279
|
+
enableAutoCleanup: true
|
|
280
|
+
}
|
|
281
|
+
})
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Build Commands
|
|
285
|
+
|
|
286
|
+
```json
|
|
287
|
+
// package.json
|
|
288
|
+
{
|
|
289
|
+
"scripts": {
|
|
290
|
+
"build:main": "SITE_ENV=main nuxt build",
|
|
291
|
+
"build:partner": "SITE_ENV=partner nuxt build",
|
|
292
|
+
"build:staging": "SITE_ENV=staging nuxt build"
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Directory Structure
|
|
298
|
+
|
|
299
|
+
```
|
|
300
|
+
project/
|
|
301
|
+
โโโ .llms-templates/
|
|
302
|
+
โ โโโ main/ # Main site templates & cache
|
|
303
|
+
โ โโโ partner/ # Partner site templates & cache
|
|
304
|
+
โ โโโ staging/ # Staging site templates & cache
|
|
305
|
+
โโโ .output/
|
|
306
|
+
โ โโโ llms/
|
|
307
|
+
โ โโโ main/ # Main site docs
|
|
308
|
+
โ โโโ partner/ # Partner site docs
|
|
309
|
+
โ โโโ staging/ # Staging site docs
|
|
310
|
+
โโโ public/
|
|
311
|
+
โ โโโ UmbracoData-main.json
|
|
312
|
+
โ โโโ UmbracoData-partner.json
|
|
313
|
+
โ โโโ UmbracoData-staging.json
|
|
314
|
+
โโโ templates/
|
|
315
|
+
โโโ main/ # Main site templates
|
|
316
|
+
โโโ partner/ # Partner site templates
|
|
317
|
+
โโโ staging/ # Staging site templates
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## ๐ Generated Output Examples
|
|
323
|
+
|
|
324
|
+
### `llms.txt` (Navigation Index)
|
|
325
|
+
```markdown
|
|
326
|
+
# Business Communication Solutions | Voicenter
|
|
327
|
+
|
|
328
|
+
> Thousands of organizations in Israel manage their business communications through our advanced cloud platform
|
|
329
|
+
|
|
330
|
+
This website contains comprehensive information about business communication solutions. The content is organized into the following sections:
|
|
331
|
+
|
|
332
|
+
## Services
|
|
333
|
+
|
|
334
|
+
- [Call Center Solutions](call-center-solutions.md): Complete call center management tools
|
|
335
|
+
- [Smart PBX for Business](smart-pbx-business.md): Advanced business telephony services
|
|
336
|
+
- [Mobile Solutions](mobile-solutions.md): Unlimited mobile communication solutions
|
|
337
|
+
|
|
338
|
+
## Technical
|
|
339
|
+
|
|
340
|
+
- [API Integration](api-integration.md): Developer tools and API documentation
|
|
341
|
+
- [CRM Connectivity](crm-connectivity.md): Full CRM integration capabilities
|
|
342
|
+
|
|
343
|
+
## Optional
|
|
344
|
+
|
|
345
|
+
- [Complete Documentation](llms-full.txt): All content combined in a single file
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Individual `.md` Files
|
|
349
|
+
```markdown
|
|
350
|
+
# Call Center Solutions
|
|
351
|
+
|
|
352
|
+
> Complete call center management tools for modern businesses
|
|
353
|
+
|
|
354
|
+
## Overview
|
|
355
|
+
|
|
356
|
+
Our call center solutions provide comprehensive tools for managing customer communications efficiently. Built on advanced cloud technology, these tools enable seamless implementation and superior organizational management.
|
|
357
|
+
|
|
358
|
+
## Key Features
|
|
359
|
+
|
|
360
|
+
- **Advanced Queue Management**: Intelligent call routing and distribution
|
|
361
|
+
- **Automated Callbacks**: Smart callback scheduling system
|
|
362
|
+
- **CRM Integration**: Seamless connection with existing CRM systems
|
|
363
|
+
- **Real-time Analytics**: Live monitoring and performance dashboards
|
|
364
|
+
- **Multi-channel Support**: Handle calls, emails, and chat in one platform
|
|
365
|
+
|
|
366
|
+
## Benefits
|
|
367
|
+
|
|
368
|
+
- Reduced customer wait times
|
|
369
|
+
- Increased agent productivity
|
|
370
|
+
- Better customer satisfaction scores
|
|
371
|
+
- Scalable solution that grows with your business
|
|
372
|
+
|
|
373
|
+
*Generated with Claude AI | Last updated: 2024-01-16*
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## ๐ง Advanced Usage
|
|
379
|
+
|
|
380
|
+
### Custom Build Script
|
|
381
|
+
|
|
382
|
+
```javascript
|
|
383
|
+
// scripts/generate-docs.js
|
|
384
|
+
import { LLMSFilesGenerator } from 'nuxt-llms-generator'
|
|
385
|
+
|
|
386
|
+
const config = {
|
|
387
|
+
anthropicApiKey: process.env.ANTHROPIC_API_KEY,
|
|
388
|
+
umbracoDataPath: './public/UmbracoData.json',
|
|
389
|
+
finalOutputDir: './docs/ai-generated'
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
const generator = new LLMSFilesGenerator(config)
|
|
393
|
+
|
|
394
|
+
try {
|
|
395
|
+
const files = await generator.generateAllFiles()
|
|
396
|
+
console.log(`โ
Generated ${files.individualMdFiles?.length || 0} markdown files`)
|
|
397
|
+
console.log('๐ LLMS documentation generation complete!')
|
|
398
|
+
} catch (error) {
|
|
399
|
+
console.error('โ Generation failed:', error)
|
|
400
|
+
process.exit(1)
|
|
401
|
+
}
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### Development vs Production
|
|
405
|
+
|
|
406
|
+
```typescript
|
|
407
|
+
// nuxt.config.ts
|
|
408
|
+
const isDev = process.env.NODE_ENV === 'development'
|
|
409
|
+
|
|
410
|
+
export default defineNuxtConfig({
|
|
411
|
+
llmsGenerator: {
|
|
412
|
+
anthropicApiKey: process.env.ANTHROPIC_API_KEY,
|
|
413
|
+
umbracoDataPath: './public/UmbracoData.json',
|
|
414
|
+
|
|
415
|
+
// Generate fewer files during development
|
|
416
|
+
enableIndividualMd: !isDev,
|
|
417
|
+
enableLLMSFullTxt: !isDev,
|
|
418
|
+
|
|
419
|
+
// Lower concurrency in development
|
|
420
|
+
maxConcurrent: isDev ? 2 : 8
|
|
421
|
+
}
|
|
422
|
+
})
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### CI/CD Integration
|
|
426
|
+
|
|
427
|
+
```yaml
|
|
428
|
+
# .github/workflows/build.yml
|
|
429
|
+
name: Generate Documentation
|
|
430
|
+
on:
|
|
431
|
+
push:
|
|
432
|
+
branches: [main]
|
|
433
|
+
|
|
434
|
+
jobs:
|
|
435
|
+
docs:
|
|
436
|
+
runs-on: ubuntu-latest
|
|
437
|
+
steps:
|
|
438
|
+
- uses: actions/checkout@v3
|
|
439
|
+
- uses: actions/setup-node@v3
|
|
440
|
+
with:
|
|
441
|
+
node-version: 18
|
|
442
|
+
- run: npm ci
|
|
443
|
+
- run: npm run build
|
|
444
|
+
env:
|
|
445
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
446
|
+
- name: Deploy docs
|
|
447
|
+
run: cp -r .output/llms/* ./public/docs/
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
## ๐งช Testing
|
|
453
|
+
|
|
454
|
+
Run the comprehensive test suite:
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
npm test
|
|
458
|
+
# or
|
|
459
|
+
npm run test:watch # Watch mode
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### Test Coverage
|
|
463
|
+
|
|
464
|
+
- โ
Template generation and caching
|
|
465
|
+
- โ
HTML-to-markdown conversion
|
|
466
|
+
- โ
Multi-language content handling
|
|
467
|
+
- โ
Page visibility filtering
|
|
468
|
+
- โ
Orphaned template cleanup
|
|
469
|
+
- โ
Configuration validation
|
|
470
|
+
- โ
Error handling and resilience
|
|
471
|
+
|
|
472
|
+
---
|
|
473
|
+
|
|
474
|
+
## ๐ Troubleshooting
|
|
475
|
+
|
|
476
|
+
### Common Issues
|
|
477
|
+
|
|
478
|
+
**โ "Claude API key not found"**
|
|
479
|
+
```bash
|
|
480
|
+
# Make sure your API key is set
|
|
481
|
+
echo $ANTHROPIC_API_KEY
|
|
482
|
+
# Should show: sk-ant-api03-...
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
**โ "UmbracoData.json not found"**
|
|
486
|
+
```bash
|
|
487
|
+
# Check the file exists
|
|
488
|
+
ls -la public/UmbracoData.json
|
|
489
|
+
# Verify path in nuxt.config.ts matches
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
**โ "Template generation failed"**
|
|
493
|
+
- Check Claude API quota and rate limits
|
|
494
|
+
- Verify UmbracoData.json has valid structure
|
|
495
|
+
- Enable debug logging: `DEBUG=llms:* npm run build`
|
|
496
|
+
|
|
497
|
+
### Performance Tips
|
|
498
|
+
|
|
499
|
+
1. **Large Sites (1000+ pages)**:
|
|
500
|
+
```typescript
|
|
501
|
+
{
|
|
502
|
+
maxConcurrent: 8, // Higher concurrency
|
|
503
|
+
enableAutoCleanup: true, // Keep cache clean
|
|
504
|
+
}
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
2. **Development Speed**:
|
|
508
|
+
```typescript
|
|
509
|
+
{
|
|
510
|
+
enableIndividualMd: false, // Skip individual files
|
|
511
|
+
maxConcurrent: 2, // Lower API usage
|
|
512
|
+
}
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
3. **Production Optimization**:
|
|
516
|
+
```typescript
|
|
517
|
+
{
|
|
518
|
+
enableAutoCleanup: true,
|
|
519
|
+
cleanupOrphaned: true,
|
|
520
|
+
cleanupHidden: true,
|
|
521
|
+
enableHtmlToMarkdown: true // Clean HTML from CMS content
|
|
522
|
+
}
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
4. **HTML Content Processing**:
|
|
526
|
+
```typescript
|
|
527
|
+
{
|
|
528
|
+
enableHtmlToMarkdown: true, // Convert <p>, <h1>, etc. to clean markdown
|
|
529
|
+
enableHtmlToMarkdown: false // Keep HTML as-is (if AI already generates clean content)
|
|
530
|
+
}
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
---
|
|
534
|
+
|
|
535
|
+
## ๐ API Reference
|
|
536
|
+
|
|
537
|
+
### LLMSFilesGenerator
|
|
538
|
+
|
|
539
|
+
```typescript
|
|
540
|
+
import { LLMSFilesGenerator } from 'nuxt-llms-generator'
|
|
541
|
+
|
|
542
|
+
const generator = new LLMSFilesGenerator({
|
|
543
|
+
anthropicApiKey: 'your-api-key',
|
|
544
|
+
umbracoDataPath: './data.json',
|
|
545
|
+
finalOutputDir: './output'
|
|
546
|
+
})
|
|
547
|
+
|
|
548
|
+
// Generate all documentation files
|
|
549
|
+
const files = await generator.generateAllFiles()
|
|
550
|
+
|
|
551
|
+
// Test Claude API connection
|
|
552
|
+
const isConnected = await generator.testConnection()
|
|
553
|
+
|
|
554
|
+
// Clear template cache
|
|
555
|
+
generator.clearCache()
|
|
556
|
+
|
|
557
|
+
// Get generation statistics
|
|
558
|
+
const stats = generator.getStats()
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
### Configuration Interface
|
|
562
|
+
|
|
563
|
+
```typescript
|
|
564
|
+
interface LLMSConfig {
|
|
565
|
+
// Required
|
|
566
|
+
anthropicApiKey: string;
|
|
567
|
+
umbracoDataPath: string;
|
|
568
|
+
|
|
569
|
+
// Optional with defaults
|
|
570
|
+
templatesDir?: string; // './.llms-templates'
|
|
571
|
+
finalOutputDir?: string; // './.output/llms'
|
|
572
|
+
anthropicModel?: string; // 'claude-3-5-sonnet-20241022'
|
|
573
|
+
maxConcurrent?: number; // 5
|
|
574
|
+
enableLLMSFullTxt?: boolean; // true
|
|
575
|
+
enableIndividualMd?: boolean; // true
|
|
576
|
+
enableHtmlToMarkdown?: boolean; // true
|
|
577
|
+
enableAutoCleanup?: boolean; // true
|
|
578
|
+
cleanupOrphaned?: boolean; // true
|
|
579
|
+
cleanupHidden?: boolean; // true
|
|
580
|
+
}
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
---
|
|
584
|
+
|
|
585
|
+
## ๐ค Contributing
|
|
586
|
+
|
|
587
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
588
|
+
|
|
589
|
+
### Development Setup
|
|
590
|
+
|
|
591
|
+
```bash
|
|
592
|
+
git clone https://github.com/your-org/nuxt-llms-generator.git
|
|
593
|
+
cd nuxt-llms-generator
|
|
594
|
+
npm install
|
|
595
|
+
npm run dev
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
### Running Tests
|
|
599
|
+
|
|
600
|
+
```bash
|
|
601
|
+
npm test # Run all tests
|
|
602
|
+
npm run test:watch # Watch mode
|
|
603
|
+
npm run test:coverage # Coverage report
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
---
|
|
607
|
+
|
|
608
|
+
## ๐ License
|
|
609
|
+
|
|
610
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
611
|
+
|
|
612
|
+
---
|
|
613
|
+
|
|
614
|
+
## ๐ Acknowledgments
|
|
615
|
+
|
|
616
|
+
- [Anthropic](https://anthropic.com) for Claude AI API
|
|
617
|
+
- [Jeremy Howard](https://github.com/jph00) for the 2024 LLMS.txt standard
|
|
618
|
+
- [Nuxt 3](https://nuxt.com) for the amazing framework
|
|
619
|
+
- The open-source community for inspiration and feedback
|
|
620
|
+
|
|
621
|
+
---
|
|
622
|
+
|
|
623
|
+
**Made with โค๏ธ for the AI-first web**
|
|
624
|
+
|
|
625
|
+
Transform your CMS content into AI-optimized documentation that helps AI systems understand your business better.
|