claude-presentation-master 3.0.1 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli.js CHANGED
@@ -11,8 +11,8 @@
11
11
  * cpm --help
12
12
  */
13
13
 
14
- import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs';
15
- import { resolve, dirname, basename, extname } from 'path';
14
+ import { readFileSync, writeFileSync, mkdirSync, existsSync, readdirSync } from 'fs';
15
+ import { resolve, dirname, basename, extname, join } from 'path';
16
16
  import { fileURLToPath } from 'url';
17
17
 
18
18
  // Parse command line arguments
@@ -293,6 +293,48 @@ Usage:
293
293
  }
294
294
  }
295
295
 
296
+ /**
297
+ * Scan directory for image files (jpg, jpeg, png, gif, webp, svg).
298
+ * Returns paths relative to the directory.
299
+ */
300
+ function scanForImages(directory) {
301
+ const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.svg'];
302
+ const images = [];
303
+
304
+ // Scan the directory and images subdirectory
305
+ const dirsToScan = [directory];
306
+ const imagesDir = join(directory, 'images');
307
+ if (existsSync(imagesDir)) {
308
+ dirsToScan.push(imagesDir);
309
+ }
310
+ const screenshotsDir = join(directory, 'screenshots');
311
+ if (existsSync(screenshotsDir)) {
312
+ dirsToScan.push(screenshotsDir);
313
+ }
314
+ const assetsDir = join(directory, 'assets');
315
+ if (existsSync(assetsDir)) {
316
+ dirsToScan.push(assetsDir);
317
+ }
318
+
319
+ for (const dir of dirsToScan) {
320
+ try {
321
+ const files = readdirSync(dir);
322
+ for (const file of files) {
323
+ const ext = extname(file).toLowerCase();
324
+ if (imageExtensions.includes(ext)) {
325
+ // Store relative path from input directory
326
+ const relativePath = dir === directory ? file : join(basename(dir), file);
327
+ images.push(relativePath);
328
+ }
329
+ }
330
+ } catch (e) {
331
+ // Directory might not exist or not be readable
332
+ }
333
+ }
334
+
335
+ return images;
336
+ }
337
+
296
338
  // Generate command
297
339
  async function runGenerate(inputPath, options, generate) {
298
340
  console.log(`
@@ -306,6 +348,13 @@ async function runGenerate(inputPath, options, generate) {
306
348
  console.log(`šŸ“„ Reading: ${inputPath}`);
307
349
  const content = readFileSync(inputPath, 'utf-8');
308
350
 
351
+ // Scan for local images in input directory
352
+ const inputDir = dirname(inputPath);
353
+ const localImages = scanForImages(inputDir);
354
+ if (localImages.length > 0) {
355
+ console.log(`šŸ–¼ļø Found ${localImages.length} local images: ${localImages.slice(0, 3).join(', ')}${localImages.length > 3 ? '...' : ''}`);
356
+ }
357
+
309
358
  // Determine title
310
359
  const title = options.title || basename(inputPath, extname(inputPath));
311
360
 
@@ -320,7 +369,9 @@ async function runGenerate(inputPath, options, generate) {
320
369
  title,
321
370
  author: options.author,
322
371
  qaThreshold: options.threshold,
323
- skipQA: options.skipQA
372
+ skipQA: options.skipQA,
373
+ images: localImages, // Local images for backgrounds
374
+ imageBasePath: inputDir // Base path for resolving relative image paths
324
375
  };
325
376
 
326
377
  console.log(`
@@ -360,6 +411,9 @@ async function runGenerate(inputPath, options, generate) {
360
411
  }
361
412
 
362
413
  // Show results
414
+ const avgWords = result.metadata.avgWordsPerSlide?.toFixed(1) ?? 'N/A';
415
+ const estimatedDuration = Math.ceil((result.metadata.totalWords || 0) / 150); // ~150 words per minute
416
+
363
417
  console.log(`
364
418
  ╔════════════════════════════════════════════════════════╗
365
419
  ā•‘ QA RESULTS ā•‘
@@ -369,24 +423,12 @@ async function runGenerate(inputPath, options, generate) {
369
423
 
370
424
  šŸ“ˆ Metadata:
371
425
  Slides: ${result.metadata.slideCount}
372
- Words: ${result.metadata.wordCount}
373
- Avg/Slide: ${result.metadata.avgWordsPerSlide}
374
- Duration: ~${result.metadata.estimatedDuration} minutes
375
-
376
- šŸŽ“ Frameworks Applied:
377
- ${result.metadata.frameworks.map(f => ` • ${f}`).join('\n') || ' (none detected)'}
426
+ Words: ${result.metadata.totalWords || 'N/A'}
427
+ Avg/Slide: ${avgWords}
428
+ Duration: ~${estimatedDuration} minutes
429
+ Type: ${result.metadata.presentationType}
378
430
  `);
379
431
 
380
- // Show issues if any
381
- const errors = result.qaResults.issues.filter(i => i.severity === 'error');
382
- const warnings = result.qaResults.issues.filter(i => i.severity === 'warning');
383
-
384
- if (errors.length > 0 || warnings.length > 0) {
385
- console.log('āš ļø Issues:');
386
- errors.forEach(e => console.log(` āŒ ${e.message}`));
387
- warnings.forEach(w => console.log(` āš ļø ${w.message}`));
388
- }
389
-
390
432
  console.log('\n✨ Generation complete!');
391
433
 
392
434
  } catch (error) {