@voicenter-team/nuxt-llms-generator 0.1.0 → 0.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 +18 -7
- package/dist/chunks/llms-files-generator.mjs +15 -5
- package/dist/module.d.mts +1 -0
- package/dist/module.d.ts +1 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/shared/{nuxt-llms-generator.dc009f50.mjs → nuxt-llms-generator.3c82efc0.mjs} +4 -2
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -237,12 +237,13 @@ npm run build
|
|
|
237
237
|
|
|
238
238
|
### Generation Options
|
|
239
239
|
|
|
240
|
-
| Option
|
|
241
|
-
|
|
242
|
-
| `enableIndividualMd`
|
|
243
|
-
| `enableLLMSFullTxt`
|
|
244
|
-
| `
|
|
245
|
-
| `
|
|
240
|
+
| Option | Type | Default | Description |
|
|
241
|
+
|------------------------|-----------|------------------------------|------------------------------------------|
|
|
242
|
+
| `enableIndividualMd` | `boolean` | `true` | Generate individual .md files per page |
|
|
243
|
+
| `enableLLMSFullTxt` | `boolean` | `true` | Generate combined llms-full.txt file |
|
|
244
|
+
| `enableHtmlToMarkdown` | `boolean` | `true` | Convert HTML content to markdown using [node-html-markdown](https://www.npmjs.com/package/node-html-markdown) |
|
|
245
|
+
| `maxConcurrent` | `number` | `5` | Maximum concurrent API requests |
|
|
246
|
+
| `anthropicModel` | `string` | `claude-3-5-sonnet-20241022` | Claude model to use |
|
|
246
247
|
|
|
247
248
|
### Cleanup Options
|
|
248
249
|
|
|
@@ -518,7 +519,16 @@ ls -la public/UmbracoData.json
|
|
|
518
519
|
{
|
|
519
520
|
enableAutoCleanup: true,
|
|
520
521
|
cleanupOrphaned: true,
|
|
521
|
-
cleanupHidden: true
|
|
522
|
+
cleanupHidden: true,
|
|
523
|
+
enableHtmlToMarkdown: true // Clean HTML from CMS content
|
|
524
|
+
}
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
4. **HTML Content Processing**:
|
|
528
|
+
```typescript
|
|
529
|
+
{
|
|
530
|
+
enableHtmlToMarkdown: true, // Convert <p>, <h1>, etc. to clean markdown
|
|
531
|
+
enableHtmlToMarkdown: false // Keep HTML as-is (if AI already generates clean content)
|
|
522
532
|
}
|
|
523
533
|
```
|
|
524
534
|
|
|
@@ -566,6 +576,7 @@ interface LLMSConfig {
|
|
|
566
576
|
maxConcurrent?: number; // 5
|
|
567
577
|
enableLLMSFullTxt?: boolean; // true
|
|
568
578
|
enableIndividualMd?: boolean; // true
|
|
579
|
+
enableHtmlToMarkdown?: boolean; // true
|
|
569
580
|
enableAutoCleanup?: boolean; // true
|
|
570
581
|
cleanupOrphaned?: boolean; // true
|
|
571
582
|
cleanupHidden?: boolean; // true
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
2
|
-
import { join, dirname } from 'path';
|
|
2
|
+
import { join, dirname, basename } from 'path';
|
|
3
3
|
import Mustache from 'mustache';
|
|
4
4
|
import Anthropic from '@anthropic-ai/sdk';
|
|
5
5
|
import { createHash } from 'crypto';
|
|
6
6
|
import { JSONPath } from 'jsonpath-plus';
|
|
7
|
-
import { T as TemplateError, E as ErrorCode, w as withErrorHandling } from '../shared/nuxt-llms-generator.
|
|
7
|
+
import { T as TemplateError, E as ErrorCode, w as withErrorHandling } from '../shared/nuxt-llms-generator.3c82efc0.mjs';
|
|
8
|
+
import { NodeHtmlMarkdown } from 'node-html-markdown';
|
|
8
9
|
import '@nuxt/kit';
|
|
9
10
|
import 'zod';
|
|
10
11
|
|
|
@@ -1067,6 +1068,11 @@ class TemplateGenerator {
|
|
|
1067
1068
|
promptAnalyzer;
|
|
1068
1069
|
cache;
|
|
1069
1070
|
config;
|
|
1071
|
+
nhm = new NodeHtmlMarkdown(
|
|
1072
|
+
{},
|
|
1073
|
+
void 0,
|
|
1074
|
+
void 0
|
|
1075
|
+
);
|
|
1070
1076
|
constructor(config) {
|
|
1071
1077
|
this.config = config;
|
|
1072
1078
|
this.anthropicClient = new AnthropicClient(config);
|
|
@@ -1211,7 +1217,11 @@ class TemplateGenerator {
|
|
|
1211
1217
|
async renderTemplate(template, data) {
|
|
1212
1218
|
return withErrorHandling(async () => {
|
|
1213
1219
|
const validatedTemplate = await templateValidationPipeline.validateAndFix(template);
|
|
1214
|
-
|
|
1220
|
+
const renderedContent = Mustache.render(validatedTemplate, data);
|
|
1221
|
+
if (this.config.enableHtmlToMarkdown) {
|
|
1222
|
+
return this.nhm.translate(renderedContent);
|
|
1223
|
+
}
|
|
1224
|
+
return renderedContent;
|
|
1215
1225
|
}, {
|
|
1216
1226
|
template: template.substring(0, 200) + "...",
|
|
1217
1227
|
dataKeys: Object.keys(data)
|
|
@@ -1502,8 +1512,8 @@ class LLMSFilesGenerator {
|
|
|
1502
1512
|
return filename;
|
|
1503
1513
|
}
|
|
1504
1514
|
getLLMSFilePath(fullPath) {
|
|
1505
|
-
const filename = fullPath
|
|
1506
|
-
return
|
|
1515
|
+
const filename = basename(fullPath);
|
|
1516
|
+
return `/llms/${filename}`;
|
|
1507
1517
|
}
|
|
1508
1518
|
getOutputDir() {
|
|
1509
1519
|
return this.config.finalOutputDir || "dist";
|
package/dist/module.d.mts
CHANGED
package/dist/module.d.ts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -19,7 +19,8 @@ const LLMSConfigSchema = z.object({
|
|
|
19
19
|
enableIndividualMd: z.boolean().optional().default(true),
|
|
20
20
|
enableAutoCleanup: z.boolean().optional().default(true),
|
|
21
21
|
cleanupOrphaned: z.boolean().optional().default(true),
|
|
22
|
-
cleanupHidden: z.boolean().optional().default(true)
|
|
22
|
+
cleanupHidden: z.boolean().optional().default(true),
|
|
23
|
+
enableHtmlToMarkdown: z.boolean().optional().default(true)
|
|
23
24
|
}).strict();
|
|
24
25
|
class SchemaValidator {
|
|
25
26
|
static validateConfig(config) {
|
|
@@ -210,7 +211,8 @@ const DEFAULT_OPTIONS = {
|
|
|
210
211
|
finalOutputDir: "public",
|
|
211
212
|
enableAutoCleanup: true,
|
|
212
213
|
cleanupOrphaned: true,
|
|
213
|
-
cleanupHidden: true
|
|
214
|
+
cleanupHidden: true,
|
|
215
|
+
enableHtmlToMarkdown: true
|
|
214
216
|
};
|
|
215
217
|
const llmsModule = defineNuxtModule({
|
|
216
218
|
meta: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voicenter-team/nuxt-llms-generator",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Nuxt 3 module for automatically generating AI-optimized documentation files (llms.txt, llms-full.txt, and individual .md files) from Umbraco CMS data using Anthropic's Claude API.",
|
|
5
5
|
"repository": "your-org/my-module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,8 +42,11 @@
|
|
|
42
42
|
"@anthropic-ai/sdk": "^0.30.0",
|
|
43
43
|
"@nuxt/kit": "^3.11.2",
|
|
44
44
|
"@voicenter-team/eslint-config-ts": "^1.0.22",
|
|
45
|
+
"i": "^0.3.7",
|
|
45
46
|
"jsonpath-plus": "^8.0.0",
|
|
46
47
|
"mustache": "^4.2.0",
|
|
48
|
+
"node-html-markdown": "^1.3.0",
|
|
49
|
+
"npm": "^11.6.0",
|
|
47
50
|
"zod": "^4.1.9"
|
|
48
51
|
},
|
|
49
52
|
"devDependencies": {
|