@edtools/cli 0.3.1 → 0.3.2

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.
@@ -1,8 +1,6 @@
1
1
  import { Adapter, BlogPostContent } from '../../types/index.js';
2
2
  export declare class HTMLAdapter implements Adapter {
3
3
  name: string;
4
- private templatePath;
5
- constructor();
6
4
  detect(projectPath: string): Promise<boolean>;
7
5
  render(content: BlogPostContent): Promise<string>;
8
6
  write(output: string, outputPath: string): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/html/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAKhE,qBAAa,WAAY,YAAW,OAAO;IACzC,IAAI,SAAU;IACd,OAAO,CAAC,YAAY,CAAS;;IAOvB,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAe7C,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IA2BjD,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ9D,gBAAgB,IAAI,MAAM;IAI1B,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;YAWzB,cAAc;YAOd,oBAAoB;IAsBlC,OAAO,CAAC,qBAAqB;IAiC7B,OAAO,CAAC,UAAU;IAyBlB,OAAO,CAAC,UAAU;IAoBlB,OAAO,CAAC,UAAU;CAUnB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/html/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAKhE,qBAAa,WAAY,YAAW,OAAO;IACzC,IAAI,SAAU;IAER,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAe7C,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAmCjD,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ9D,gBAAgB,IAAI,MAAM;IAI1B,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;YAWzB,cAAc;YAOd,oBAAoB;IAsBlC,OAAO,CAAC,qBAAqB;IAiC7B,OAAO,CAAC,UAAU;IAyBlB,OAAO,CAAC,UAAU;IAoBlB,OAAO,CAAC,UAAU;CAUnB"}
@@ -7,10 +7,6 @@ const __filename = fileURLToPath(import.meta.url);
7
7
  const __dirname = path.dirname(__filename);
8
8
  export class HTMLAdapter {
9
9
  name = 'html';
10
- templatePath;
11
- constructor() {
12
- this.templatePath = path.join(__dirname, 'templates', 'blog-post.html.ejs');
13
- }
14
10
  async detect(projectPath) {
15
11
  try {
16
12
  const files = await fs.readdir(projectPath);
@@ -23,7 +19,11 @@ export class HTMLAdapter {
23
19
  }
24
20
  }
25
21
  async render(content) {
26
- const template = await fs.readFile(this.templatePath, 'utf-8');
22
+ const templatePath = path.join(__dirname, 'templates', 'blog-post.html.ejs');
23
+ if (!await fs.pathExists(templatePath)) {
24
+ throw new Error(`Template not found at: ${templatePath}`);
25
+ }
26
+ const template = await fs.readFile(templatePath, 'utf-8');
27
27
  const templateData = {
28
28
  metadata: content.metadata,
29
29
  schemaOrg: JSON.stringify(content.schemaOrg, null, 2),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/html/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,MAAM,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,IAAI,CAAC;IACd,CAAC;IAKO,UAAU,CAAC,IAAS;QAC1B,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACxB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,IAAI,GAAG,4BAA4B,CAAC;QAExC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,IAAI,+BAA+B,IAAI,CAAC,OAAO,UAAU,CAAC;QAChE,CAAC;QAED,IAAI,IAAI,gCAAgC,IAAI,CAAC,QAAQ,IAAI,WAAW,KAAK,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC;QACrH,IAAI,IAAI,QAAQ,CAAC;QAEjB,OAAO,IAAI,CAAC;IACd,CAAC;IAKO,UAAU,CAAC,IAAY;QAC7B,MAAM,GAAG,GAA2B;YAClC,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,MAAM;YACX,GAAG,EAAE,MAAM;YACX,GAAG,EAAE,QAAQ;YACb,GAAG,EAAE,QAAQ;SACd,CAAC;QACF,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;CACF"}
@@ -0,0 +1,522 @@
1
+ // src/types/adapter.ts
2
+ var AdapterRegistry = class {
3
+ adapters;
4
+ constructor() {
5
+ this.adapters = /* @__PURE__ */ new Map();
6
+ }
7
+ register(adapter) {
8
+ this.adapters.set(adapter.name, adapter);
9
+ }
10
+ get(name) {
11
+ return this.adapters.get(name);
12
+ }
13
+ async detectAdapter(projectPath) {
14
+ for (const adapter of this.adapters.values()) {
15
+ if (await adapter.detect(projectPath)) {
16
+ return adapter;
17
+ }
18
+ }
19
+ return null;
20
+ }
21
+ list() {
22
+ return Array.from(this.adapters.keys());
23
+ }
24
+ };
25
+
26
+ // src/adapters/html/index.ts
27
+ import fs from "fs-extra";
28
+ import path from "path";
29
+ import { fileURLToPath } from "url";
30
+ import ejs from "ejs";
31
+ import { marked } from "marked";
32
+ var __filename = fileURLToPath(import.meta.url);
33
+ var __dirname = path.dirname(__filename);
34
+ var HTMLAdapter = class {
35
+ name = "html";
36
+ async detect(projectPath) {
37
+ try {
38
+ const files = await fs.readdir(projectPath);
39
+ const hasHtml = files.some((f) => f.endsWith(".html"));
40
+ const hasIndexHtml = await fs.pathExists(path.join(projectPath, "index.html"));
41
+ return hasHtml || hasIndexHtml;
42
+ } catch (error) {
43
+ return false;
44
+ }
45
+ }
46
+ async render(content) {
47
+ const templatePath = path.join(__dirname, "templates", "blog-post.html.ejs");
48
+ if (!await fs.pathExists(templatePath)) {
49
+ throw new Error(`Template not found at: ${templatePath}`);
50
+ }
51
+ const template = await fs.readFile(templatePath, "utf-8");
52
+ const templateData = {
53
+ metadata: content.metadata,
54
+ schemaOrg: JSON.stringify(content.schemaOrg, null, 2),
55
+ intro: await this.markdownToHTML(content.content.intro),
56
+ sections: await Promise.all(
57
+ content.content.sections.map(async (section) => ({
58
+ ...section,
59
+ content: await this.renderSectionContent(section)
60
+ }))
61
+ ),
62
+ conclusion: await this.markdownToHTML(content.content.conclusion),
63
+ cta: content.content.cta,
64
+ relatedPosts: content.relatedPosts || [],
65
+ seoScore: content.seo.score
66
+ };
67
+ const html = ejs.render(template, templateData);
68
+ return html;
69
+ }
70
+ async write(output, outputPath) {
71
+ await fs.ensureDir(path.dirname(outputPath));
72
+ await fs.writeFile(outputPath, output, "utf-8");
73
+ }
74
+ getFileExtension() {
75
+ return ".html";
76
+ }
77
+ transformPath(basePath) {
78
+ if (!basePath.endsWith(".html")) {
79
+ return basePath + "/index.html";
80
+ }
81
+ return basePath;
82
+ }
83
+ /**
84
+ * Convert markdown to HTML
85
+ */
86
+ async markdownToHTML(markdown) {
87
+ return marked(markdown);
88
+ }
89
+ /**
90
+ * Render section content based on type
91
+ */
92
+ async renderSectionContent(section) {
93
+ switch (section.type) {
94
+ case "text":
95
+ return await this.markdownToHTML(section.content);
96
+ case "comparison":
97
+ return this.renderComparisonTable(section.data);
98
+ case "list":
99
+ return this.renderList(section.data);
100
+ case "code":
101
+ return this.renderCode(section.data);
102
+ default:
103
+ return await this.markdownToHTML(section.content);
104
+ }
105
+ }
106
+ /**
107
+ * Render comparison table
108
+ */
109
+ renderComparisonTable(data) {
110
+ if (!data || !data.headers || !data.rows) {
111
+ return "";
112
+ }
113
+ let html = '<table class="comparison-table">\n';
114
+ html += " <thead>\n <tr>\n";
115
+ data.headers.forEach((header) => {
116
+ html += ` <th>${header}</th>
117
+ `;
118
+ });
119
+ html += " </tr>\n </thead>\n";
120
+ html += " <tbody>\n";
121
+ data.rows.forEach((row) => {
122
+ html += " <tr>\n";
123
+ row.forEach((cell) => {
124
+ html += ` <td>${cell}</td>
125
+ `;
126
+ });
127
+ html += " </tr>\n";
128
+ });
129
+ html += " </tbody>\n";
130
+ html += "</table>";
131
+ return html;
132
+ }
133
+ /**
134
+ * Render list
135
+ */
136
+ renderList(data) {
137
+ if (!data || !data.items) {
138
+ return "";
139
+ }
140
+ const tag = data.ordered ? "ol" : "ul";
141
+ let html = `<${tag} class="content-list">
142
+ `;
143
+ data.items.forEach((item) => {
144
+ html += " <li>\n";
145
+ html += ` <strong>${item.title}</strong>
146
+ `;
147
+ if (item.description) {
148
+ html += ` <p>${item.description}</p>
149
+ `;
150
+ }
151
+ html += " </li>\n";
152
+ });
153
+ html += `</${tag}>`;
154
+ return html;
155
+ }
156
+ /**
157
+ * Render code block
158
+ */
159
+ renderCode(data) {
160
+ if (!data || !data.code) {
161
+ return "";
162
+ }
163
+ let html = '<div class="code-block">\n';
164
+ if (data.caption) {
165
+ html += ` <div class="code-caption">${data.caption}</div>
166
+ `;
167
+ }
168
+ html += ` <pre><code class="language-${data.language || "plaintext"}">${this.escapeHtml(data.code)}</code></pre>
169
+ `;
170
+ html += "</div>";
171
+ return html;
172
+ }
173
+ /**
174
+ * Escape HTML entities
175
+ */
176
+ escapeHtml(text) {
177
+ const map = {
178
+ "&": "&amp;",
179
+ "<": "&lt;",
180
+ ">": "&gt;",
181
+ '"': "&quot;",
182
+ "'": "&#039;"
183
+ };
184
+ return text.replace(/[&<>"']/g, (m) => map[m]);
185
+ }
186
+ };
187
+
188
+ // src/core/generator.ts
189
+ import Anthropic from "@anthropic-ai/sdk";
190
+ import OpenAI from "openai";
191
+ import path2 from "path";
192
+ import fs2 from "fs-extra";
193
+ import slugify from "slugify";
194
+ var ContentGenerator = class {
195
+ anthropic = null;
196
+ openai = null;
197
+ provider;
198
+ adapters;
199
+ constructor(apiKey, provider = "anthropic") {
200
+ this.provider = provider;
201
+ if (provider === "anthropic") {
202
+ this.anthropic = new Anthropic({
203
+ apiKey: apiKey || process.env.ANTHROPIC_API_KEY || ""
204
+ });
205
+ } else if (provider === "openai") {
206
+ this.openai = new OpenAI({
207
+ apiKey: apiKey || process.env.OPENAI_API_KEY || ""
208
+ });
209
+ }
210
+ this.adapters = new AdapterRegistry();
211
+ this.adapters.register(new HTMLAdapter());
212
+ }
213
+ /**
214
+ * Main generate method
215
+ */
216
+ async generate(config) {
217
+ const results = {
218
+ success: true,
219
+ posts: [],
220
+ warnings: [],
221
+ errors: []
222
+ };
223
+ try {
224
+ const adapter = await this.adapters.detectAdapter(config.projectPath);
225
+ if (!adapter) {
226
+ throw new Error("No suitable adapter found for this project");
227
+ }
228
+ console.log(`\u2713 Using adapter: ${adapter.name}`);
229
+ const topics = config.topics || await this.generateTopics(config.productInfo, config.count || 3);
230
+ for (const topic of topics.slice(0, config.count || 3)) {
231
+ try {
232
+ console.log(`
233
+ \u{1F4DD} Generating: ${topic}`);
234
+ const content = await this.generateContent(config.productInfo, topic);
235
+ const output = await adapter.render(content);
236
+ const slug = content.metadata.slug;
237
+ const fileName = adapter.transformPath?.(slug) || `${slug}/index${adapter.getFileExtension()}`;
238
+ const outputPath = path2.join(config.outputDir, fileName);
239
+ await adapter.write(output, outputPath);
240
+ results.posts.push({
241
+ title: content.metadata.title,
242
+ slug,
243
+ path: outputPath,
244
+ seoScore: content.seo.score
245
+ });
246
+ console.log(`\u2713 Generated: ${outputPath}`);
247
+ console.log(` SEO Score: ${content.seo.score}/100`);
248
+ } catch (error) {
249
+ results.errors?.push(`Failed to generate "${topic}": ${error.message}`);
250
+ results.success = false;
251
+ }
252
+ }
253
+ if (results.posts.length > 0) {
254
+ await this.updateSitemap(config.projectPath, config.outputDir, results.posts);
255
+ }
256
+ } catch (error) {
257
+ results.success = false;
258
+ results.errors?.push(error.message);
259
+ }
260
+ return results;
261
+ }
262
+ /**
263
+ * Generate blog post content using the selected AI provider
264
+ */
265
+ async generateContent(productInfo, topic) {
266
+ const prompt = this.buildPrompt(productInfo, topic);
267
+ let contentData;
268
+ if (this.provider === "anthropic") {
269
+ contentData = await this.generateWithAnthropic(prompt);
270
+ } else if (this.provider === "openai") {
271
+ contentData = await this.generateWithOpenAI(prompt);
272
+ } else {
273
+ throw new Error(`Unsupported provider: ${this.provider}`);
274
+ }
275
+ const slug = slugify(contentData.metadata.title, { lower: true, strict: true });
276
+ const content = {
277
+ metadata: {
278
+ ...contentData.metadata,
279
+ slug,
280
+ datePublished: (/* @__PURE__ */ new Date()).toISOString(),
281
+ author: productInfo.name
282
+ },
283
+ schemaOrg: this.generateSchemaOrg({
284
+ ...contentData.metadata,
285
+ slug,
286
+ datePublished: (/* @__PURE__ */ new Date()).toISOString(),
287
+ author: productInfo.name
288
+ }, productInfo),
289
+ content: contentData.content,
290
+ relatedPosts: [],
291
+ seo: await this.calculateSEOScore(contentData)
292
+ };
293
+ return content;
294
+ }
295
+ /**
296
+ * Generate content using Anthropic's Claude API
297
+ */
298
+ async generateWithAnthropic(prompt) {
299
+ if (!this.anthropic) {
300
+ throw new Error("Anthropic client not initialized");
301
+ }
302
+ const response = await this.anthropic.messages.create({
303
+ model: "claude-3-5-sonnet-20241022",
304
+ max_tokens: 4096,
305
+ temperature: 0.7,
306
+ messages: [
307
+ {
308
+ role: "user",
309
+ content: prompt
310
+ }
311
+ ]
312
+ });
313
+ const textContent = response.content[0].type === "text" ? response.content[0].text : "";
314
+ const jsonMatch = textContent.match(/\{[\s\S]*\}/);
315
+ if (!jsonMatch) {
316
+ throw new Error("Failed to extract JSON from Claude response");
317
+ }
318
+ return JSON.parse(jsonMatch[0]);
319
+ }
320
+ /**
321
+ * Generate content using OpenAI's ChatGPT API
322
+ */
323
+ async generateWithOpenAI(prompt) {
324
+ if (!this.openai) {
325
+ throw new Error("OpenAI client not initialized");
326
+ }
327
+ const response = await this.openai.chat.completions.create({
328
+ model: "gpt-4-turbo-preview",
329
+ max_tokens: 4096,
330
+ temperature: 0.7,
331
+ messages: [
332
+ {
333
+ role: "user",
334
+ content: prompt
335
+ }
336
+ ],
337
+ response_format: { type: "json_object" }
338
+ });
339
+ const textContent = response.choices[0]?.message?.content || "";
340
+ if (!textContent) {
341
+ throw new Error("Failed to get response from OpenAI");
342
+ }
343
+ return JSON.parse(textContent);
344
+ }
345
+ /**
346
+ * Build prompt for Claude API
347
+ */
348
+ buildPrompt(productInfo, topic) {
349
+ return `You are an expert SEO content writer. Generate a comprehensive blog post about: "${topic}"
350
+
351
+ Product context:
352
+ - Name: ${productInfo.name}
353
+ - Tagline: ${productInfo.tagline || ""}
354
+ - Category: ${productInfo.category}
355
+ - Features: ${productInfo.features.join(", ")}
356
+ - Pricing: ${productInfo.pricingModel || "Not specified"}
357
+ ${productInfo.useCases ? `- Use cases: ${productInfo.useCases.join(", ")}` : ""}
358
+
359
+ IMPORTANT INSTRUCTIONS:
360
+ 1. Write for users searching on Google and being recommended by AI assistants (Claude, ChatGPT)
361
+ 2. Focus on being helpful, not promotional
362
+ 3. Include comparisons with alternatives when relevant
363
+ 4. Use natural language, avoid keyword stuffing
364
+ 5. Make it comprehensive (1000-1500 words worth of content)
365
+ 6. Structure with clear sections (intro, 3-5 main sections, conclusion)
366
+ 7. Be factual - do NOT invent statistics or make false claims
367
+
368
+ Output ONLY valid JSON in this exact format (no markdown, no code blocks):
369
+ {
370
+ "metadata": {
371
+ "title": "SEO-optimized title (under 60 chars)",
372
+ "description": "Meta description (under 160 chars)",
373
+ "keywords": ["keyword1", "keyword2", "keyword3"],
374
+ "category": "${productInfo.category}"
375
+ },
376
+ "content": {
377
+ "intro": "Engaging introduction paragraph in markdown format",
378
+ "sections": [
379
+ {
380
+ "heading": "Section title",
381
+ "level": 2,
382
+ "content": "Section content in markdown format",
383
+ "type": "text"
384
+ }
385
+ ],
386
+ "conclusion": "Conclusion paragraph in markdown",
387
+ "cta": {
388
+ "text": "Try ${productInfo.name}",
389
+ "url": "${productInfo.websiteUrl || "/signup"}"
390
+ }
391
+ }
392
+ }`;
393
+ }
394
+ /**
395
+ * Generate Schema.org structured data
396
+ */
397
+ generateSchemaOrg(metadata, productInfo) {
398
+ return {
399
+ "@context": "https://schema.org",
400
+ "@type": "BlogPosting",
401
+ headline: metadata.title,
402
+ description: metadata.description,
403
+ author: {
404
+ "@type": "Organization",
405
+ name: productInfo.name,
406
+ url: productInfo.websiteUrl
407
+ },
408
+ datePublished: metadata.datePublished,
409
+ publisher: {
410
+ "@type": "Organization",
411
+ name: productInfo.name
412
+ },
413
+ keywords: metadata.keywords.join(", "),
414
+ articleSection: metadata.category
415
+ };
416
+ }
417
+ /**
418
+ * Calculate SEO score
419
+ */
420
+ async calculateSEOScore(content) {
421
+ let score = 100;
422
+ const suggestions = [];
423
+ if (content.metadata.title.length > 60) {
424
+ score -= 10;
425
+ suggestions.push("Title is too long (should be under 60 chars)");
426
+ }
427
+ if (content.metadata.description.length > 160) {
428
+ score -= 10;
429
+ suggestions.push("Meta description is too long (should be under 160 chars)");
430
+ }
431
+ if (content.metadata.keywords.length < 3) {
432
+ score -= 5;
433
+ suggestions.push("Add more keywords (at least 3)");
434
+ }
435
+ if (content.content.sections.length < 3) {
436
+ score -= 10;
437
+ suggestions.push("Add more sections for better structure (at least 3)");
438
+ }
439
+ return {
440
+ score: Math.max(0, score),
441
+ suggestions
442
+ };
443
+ }
444
+ /**
445
+ * Generate topic suggestions
446
+ */
447
+ async generateTopics(productInfo, count) {
448
+ const prompt = `Generate ${count} SEO-friendly blog post topics for a product called "${productInfo.name}" in the ${productInfo.category} category.
449
+
450
+ Product description: ${productInfo.description}
451
+ Features: ${productInfo.features.join(", ")}
452
+
453
+ Requirements:
454
+ - Topics should be helpful for potential customers
455
+ - Focus on solving problems or answering questions
456
+ - Include comparisons, guides, and use cases
457
+ - Optimize for search engines and AI recommendations
458
+
459
+ Output ONLY a JSON array of topic strings, no markdown:
460
+ ["Topic 1", "Topic 2", "Topic 3"]`;
461
+ try {
462
+ if (this.provider === "anthropic" && this.anthropic) {
463
+ const response = await this.anthropic.messages.create({
464
+ model: "claude-3-5-sonnet-20241022",
465
+ max_tokens: 1024,
466
+ messages: [{ role: "user", content: prompt }]
467
+ });
468
+ const textContent = response.content[0].type === "text" ? response.content[0].text : "";
469
+ const jsonMatch = textContent.match(/\[[\s\S]*\]/);
470
+ if (jsonMatch) {
471
+ return JSON.parse(jsonMatch[0]);
472
+ }
473
+ } else if (this.provider === "openai" && this.openai) {
474
+ const response = await this.openai.chat.completions.create({
475
+ model: "gpt-4-turbo-preview",
476
+ max_tokens: 1024,
477
+ messages: [{ role: "user", content: prompt }],
478
+ response_format: { type: "json_object" }
479
+ });
480
+ const textContent = response.choices[0]?.message?.content || "";
481
+ if (textContent) {
482
+ const data = JSON.parse(textContent);
483
+ return data.topics || data;
484
+ }
485
+ }
486
+ } catch (error) {
487
+ console.warn("Failed to generate topics with AI, using fallback");
488
+ }
489
+ return [
490
+ `Best ${productInfo.category} software ${(/* @__PURE__ */ new Date()).getFullYear()}`,
491
+ `How to choose ${productInfo.category} solution`,
492
+ `${productInfo.name} vs alternatives: Complete comparison`
493
+ ];
494
+ }
495
+ /**
496
+ * Update sitemap.xml
497
+ */
498
+ async updateSitemap(projectPath, blogDir, posts) {
499
+ const sitemapPath = path2.join(projectPath, "sitemap.xml");
500
+ const urls = posts.map((post) => {
501
+ return ` <url>
502
+ <loc>${post.slug}/</loc>
503
+ <lastmod>${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}</lastmod>
504
+ <changefreq>weekly</changefreq>
505
+ <priority>0.8</priority>
506
+ </url>`;
507
+ }).join("\n");
508
+ const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
509
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
510
+ ${urls}
511
+ </urlset>`;
512
+ await fs2.writeFile(sitemapPath, sitemap, "utf-8");
513
+ console.log(`
514
+ \u2713 Updated sitemap.xml`);
515
+ }
516
+ };
517
+
518
+ export {
519
+ AdapterRegistry,
520
+ HTMLAdapter,
521
+ ContentGenerator
522
+ };
package/dist/cli/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ContentGenerator
4
- } from "../chunk-HEOHZFH2.js";
4
+ } from "../chunk-HQMZIHQM.js";
5
5
 
6
6
  // src/cli/index.ts
7
7
  import { Command } from "commander";
package/dist/index.d.ts CHANGED
@@ -160,8 +160,6 @@ declare class ContentGenerator {
160
160
 
161
161
  declare class HTMLAdapter implements Adapter {
162
162
  name: string;
163
- private templatePath;
164
- constructor();
165
163
  detect(projectPath: string): Promise<boolean>;
166
164
  render(content: BlogPostContent): Promise<string>;
167
165
  write(output: string, outputPath: string): Promise<void>;
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  AdapterRegistry,
3
3
  ContentGenerator,
4
4
  HTMLAdapter
5
- } from "./chunk-HEOHZFH2.js";
5
+ } from "./chunk-HQMZIHQM.js";
6
6
  export {
7
7
  AdapterRegistry,
8
8
  ContentGenerator,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edtools/cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Generate SEO-optimized content for LLM discovery - CLI tool",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",