claude-presentation-master 1.0.2 → 2.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/dist/index.d.mts CHANGED
@@ -1,8 +1,20 @@
1
+ import PptxGenJS from 'pptxgenjs';
2
+
1
3
  /**
2
4
  * Claude Presentation Master - Type Definitions
3
5
  * @module types
4
6
  */
7
+ /**
8
+ * Legacy presentation mode (for backwards compatibility)
9
+ * @deprecated Use PresentationType for granular control
10
+ */
5
11
  type PresentationMode = 'keynote' | 'business';
12
+ /**
13
+ * Granular presentation types with distinct validation rules.
14
+ * Each type is a "swim lane" with its own word limits, expert methodologies,
15
+ * and scoring weights. These are mutually exclusive.
16
+ */
17
+ type PresentationType = 'ted_keynote' | 'sales_pitch' | 'consulting_deck' | 'investment_banking' | 'investor_pitch' | 'technical_presentation' | 'all_hands';
6
18
  type OutputFormat = 'html' | 'pptx';
7
19
  type ThemeName = 'default' | 'light-corporate' | 'modern-tech' | 'minimal' | 'warm' | 'creative';
8
20
  interface PresentationConfig {
@@ -10,8 +22,20 @@ interface PresentationConfig {
10
22
  content: string;
11
23
  /** Content format */
12
24
  contentType: 'markdown' | 'json' | 'yaml' | 'text';
13
- /** Presentation mode: keynote (6-25 words/slide) or business (40-80 words/slide) */
25
+ /**
26
+ * Legacy presentation mode (backwards compatible)
27
+ * @deprecated Use `presentationType` for granular control
28
+ */
14
29
  mode: PresentationMode;
30
+ /**
31
+ * Granular presentation type with distinct validation rules.
32
+ * If specified, this overrides `mode` for validation purposes.
33
+ */
34
+ presentationType?: PresentationType;
35
+ /** Target audience (used for auto-detecting presentation type) */
36
+ audience?: 'board_of_directors' | 'sales_prospect' | 'investors_vcs' | 'general_audience_keynote' | 'technical_team' | 'all_hands_meeting';
37
+ /** Presentation goal (used for auto-detecting presentation type) */
38
+ goal?: 'get_approval' | 'inform_educate' | 'persuade_sell' | 'inspire_motivate' | 'report_results' | 'raise_funding';
15
39
  /** Output formats to generate */
16
40
  format: OutputFormat[];
17
41
  /** Visual theme */
@@ -35,6 +59,36 @@ interface PresentationConfig {
35
59
  /** Custom Handlebars templates */
36
60
  customTemplates?: Record<string, string>;
37
61
  }
62
+ /**
63
+ * Validation rules specific to a presentation type.
64
+ * Loaded from the knowledge base.
65
+ */
66
+ interface PresentationTypeRules {
67
+ id: PresentationType;
68
+ name: string;
69
+ description: string;
70
+ wordsPerSlide: {
71
+ min: number;
72
+ max: number;
73
+ ideal: number;
74
+ };
75
+ whitespace: {
76
+ min: number;
77
+ ideal: number;
78
+ max?: number;
79
+ };
80
+ bulletsPerSlide: {
81
+ max: number;
82
+ };
83
+ actionTitlesRequired: boolean;
84
+ sourcesRequired: boolean;
85
+ scoringWeights: {
86
+ visual_quality: number;
87
+ content_quality: number;
88
+ expert_compliance: number;
89
+ accessibility: number;
90
+ };
91
+ }
38
92
  type SlideType = 'title' | 'agenda' | 'section-divider' | 'thank-you' | 'big-idea' | 'single-statement' | 'big-number' | 'full-image' | 'quote' | 'two-column' | 'three-column' | 'bullet-points' | 'screenshot' | 'screenshot-left' | 'screenshot-right' | 'comparison' | 'timeline' | 'process' | 'metrics-grid' | 'pricing' | 'team' | 'features' | 'chart' | 'table' | 'social-proof' | 'case-study' | 'cta';
39
93
  interface Slide {
40
94
  /** Slide index (0-based) */
@@ -292,11 +346,409 @@ declare class TemplateNotFoundError extends Error {
292
346
  constructor(templatePath: string, message?: string);
293
347
  }
294
348
 
349
+ /**
350
+ * Score Calculator - QA Score Computation
351
+ *
352
+ * Calculates presentation quality scores based on:
353
+ * - Visual quality (35%)
354
+ * - Content quality (30%)
355
+ * - Expert methodology compliance (25%)
356
+ * - Accessibility (10%)
357
+ */
358
+
359
+ interface ScoreBreakdown {
360
+ visual: number;
361
+ content: number;
362
+ expert: number;
363
+ accessibility: number;
364
+ total: number;
365
+ penalties: number;
366
+ details: ScoreDetail[];
367
+ }
368
+ interface ScoreDetail {
369
+ category: string;
370
+ check: string;
371
+ score: number;
372
+ maxScore: number;
373
+ notes?: string;
374
+ }
375
+ declare class ScoreCalculator {
376
+ private readonly weights;
377
+ /**
378
+ * Calculate overall QA score from results.
379
+ */
380
+ calculate(results: QAResults): number;
381
+ /**
382
+ * Get detailed score breakdown.
383
+ */
384
+ getBreakdown(results: QAResults): ScoreBreakdown;
385
+ /**
386
+ * Calculate visual quality score.
387
+ */
388
+ private calculateVisualScore;
389
+ /**
390
+ * Calculate content quality score.
391
+ */
392
+ private calculateContentScore;
393
+ /**
394
+ * Calculate expert methodology compliance score.
395
+ */
396
+ private calculateExpertScore;
397
+ /**
398
+ * Calculate accessibility compliance score.
399
+ */
400
+ private calculateAccessibilityScore;
401
+ /**
402
+ * Calculate penalties from issues.
403
+ */
404
+ private calculatePenalties;
405
+ /**
406
+ * Get human-readable grade from score.
407
+ */
408
+ getGrade(score: number): string;
409
+ /**
410
+ * Get pass/fail status.
411
+ */
412
+ isPassing(score: number, threshold?: number): boolean;
413
+ /**
414
+ * Format score for display.
415
+ */
416
+ formatScore(score: number): string;
417
+ /**
418
+ * Generate summary report.
419
+ */
420
+ generateReport(results: QAResults): string;
421
+ }
422
+
423
+ /**
424
+ * QA Engine - Real Visual Quality Validation
425
+ *
426
+ * Unlike fake validation systems, this engine ACTUALLY tests:
427
+ * - Visual quality using Playwright screenshots + Canvas API
428
+ * - Layout balance and whitespace distribution
429
+ * - WCAG contrast compliance
430
+ * - Expert methodology adherence
431
+ */
432
+
433
+ declare class QAEngine {
434
+ private browser;
435
+ /**
436
+ * Validate a presentation.
437
+ */
438
+ validate(presentation: string | Buffer, options?: {
439
+ mode?: 'keynote' | 'business';
440
+ strictMode?: boolean;
441
+ threshold?: number;
442
+ }): Promise<QAResults>;
443
+ /**
444
+ * Calculate overall QA score.
445
+ */
446
+ calculateScore(results: QAResults): number;
447
+ /**
448
+ * Create empty QA results (for when QA is skipped).
449
+ */
450
+ createEmptyResults(): QAResults;
451
+ private runVisualTests;
452
+ private runContentTests;
453
+ private runExpertTests;
454
+ private createExpertResult;
455
+ private runAccessibilityTests;
456
+ private calculateVisualScore;
457
+ private calculateContentScore;
458
+ private calculateExpertScore;
459
+ private calculateA11yScore;
460
+ private collectIssues;
461
+ private initBrowser;
462
+ private closeBrowser;
463
+ }
464
+
465
+ /**
466
+ * PowerPoint Validator - PPTX Quality Validation
467
+ *
468
+ * Validates PowerPoint presentations for:
469
+ * - Layout correctness
470
+ * - Content quality (word counts, readability)
471
+ * - Formatting consistency (fonts, colors)
472
+ * - Accessibility compliance
473
+ * - Expert methodology adherence
474
+ *
475
+ * THIS IS A MANDATORY VALIDATION - NO PPTX EXPORT WITHOUT PASSING
476
+ */
477
+
478
+ interface PPTXValidationResult {
479
+ passed: boolean;
480
+ score: number;
481
+ issues: PPTXIssue[];
482
+ perSlide: SlideValidationResult[];
483
+ summary: ValidationSummary;
484
+ }
485
+ interface PPTXIssue {
486
+ severity: 'error' | 'warning' | 'info';
487
+ category: 'layout' | 'content' | 'formatting' | 'accessibility' | 'expert';
488
+ slideIndex?: number;
489
+ message: string;
490
+ suggestion?: string;
491
+ }
492
+ interface SlideValidationResult {
493
+ slideIndex: number;
494
+ type: string;
495
+ passed: boolean;
496
+ score: number;
497
+ issues: PPTXIssue[];
498
+ metrics: {
499
+ wordCount: number;
500
+ hasTitle: boolean;
501
+ hasContent: boolean;
502
+ estimatedReadingTime: number;
503
+ layoutScore: number;
504
+ };
505
+ }
506
+ interface ValidationSummary {
507
+ totalSlides: number;
508
+ passedSlides: number;
509
+ failedSlides: number;
510
+ totalErrors: number;
511
+ totalWarnings: number;
512
+ categories: {
513
+ layout: number;
514
+ content: number;
515
+ formatting: number;
516
+ accessibility: number;
517
+ expert: number;
518
+ };
519
+ }
520
+ declare class PPTXValidator {
521
+ /**
522
+ * Validate a set of slides before PPTX generation.
523
+ * This validation is MANDATORY - export will fail if score < threshold.
524
+ */
525
+ validate(slides: Slide[], options: {
526
+ mode: 'keynote' | 'business';
527
+ threshold?: number;
528
+ strictMode?: boolean;
529
+ }): Promise<PPTXValidationResult>;
530
+ /**
531
+ * Validate a single slide.
532
+ */
533
+ private validateSlide;
534
+ /**
535
+ * Validate cross-slide consistency.
536
+ */
537
+ private validateCrossSlide;
538
+ /**
539
+ * Validate against expert methodologies.
540
+ */
541
+ private validateExpertMethodologies;
542
+ /**
543
+ * Count words in slide content.
544
+ */
545
+ private countWords;
546
+ /**
547
+ * Check if slide has meaningful content.
548
+ */
549
+ private hasContent;
550
+ /**
551
+ * Count distinct ideas in a slide.
552
+ */
553
+ private countIdeas;
554
+ /**
555
+ * Calculate layout score for a slide.
556
+ */
557
+ private calculateLayoutScore;
558
+ /**
559
+ * Calculate overall validation score.
560
+ */
561
+ private calculateScore;
562
+ /**
563
+ * Build validation summary.
564
+ */
565
+ private buildSummary;
566
+ /**
567
+ * Convert PPTX validation result to standard QAResults format.
568
+ */
569
+ toQAResults(result: PPTXValidationResult, mode: 'keynote' | 'business'): QAResults;
570
+ private createExpertValidation;
571
+ /**
572
+ * Generate human-readable validation report.
573
+ */
574
+ generateReport(result: PPTXValidationResult): string;
575
+ }
576
+
577
+ /**
578
+ * Auto-Remediation Engine
579
+ *
580
+ * Instead of blocking on QA failures, this engine automatically fixes issues
581
+ * and iterates until the presentation passes quality thresholds.
582
+ *
583
+ * Philosophy: NEVER fail - always deliver a working, quality presentation.
584
+ *
585
+ * Remediation strategies:
586
+ * - Too many words → Summarize/split slides
587
+ * - Poor whitespace → Adjust layout
588
+ * - Failed glance test → Shorten titles
589
+ * - Too many bullets → Consolidate or split
590
+ * - Missing structure → Add required slides
591
+ * - Accessibility issues → Fix contrast/font sizes
592
+ */
593
+
594
+ interface RemediationChange {
595
+ slideIndex: number;
596
+ type: RemediationType;
597
+ description: string;
598
+ before?: string;
599
+ after?: string;
600
+ }
601
+ type RemediationType = 'word_reduction' | 'slide_split' | 'title_shortening' | 'bullet_consolidation' | 'layout_adjustment' | 'structure_addition' | 'font_size_increase' | 'content_enhancement' | 'whitespace_improvement';
602
+ declare class AutoRemediation {
603
+ private changes;
604
+ /**
605
+ * Automatically remediate slides until they pass QA.
606
+ */
607
+ remediate(slides: Slide[], issues: QAIssue[] | PPTXIssue[], options: {
608
+ mode: 'keynote' | 'business';
609
+ targetScore: number;
610
+ }): Promise<Slide[]>;
611
+ /**
612
+ * Get the changes that were applied during remediation.
613
+ */
614
+ getChanges(): RemediationChange[];
615
+ /**
616
+ * Remediate word count issues - the most common problem.
617
+ */
618
+ private remediateWordCount;
619
+ /**
620
+ * Remediate glance test failures - title too long.
621
+ */
622
+ private remediateGlanceTest;
623
+ /**
624
+ * Remediate bullet point issues.
625
+ */
626
+ private remediateBullets;
627
+ /**
628
+ * Remediate structural issues - missing title slide, conclusion, etc.
629
+ */
630
+ private remediateStructure;
631
+ /**
632
+ * Remediate accessibility issues.
633
+ */
634
+ private remediateAccessibility;
635
+ /**
636
+ * Group issues by their primary type.
637
+ */
638
+ private groupIssuesByType;
639
+ /**
640
+ * Shorten text to approximately N words while preserving meaning.
641
+ */
642
+ private shortenText;
643
+ /**
644
+ * Shorten a title to N words, keeping the key message.
645
+ */
646
+ private shortenTitle;
647
+ /**
648
+ * Consolidate bullets by combining related ones.
649
+ */
650
+ private consolidateBullets;
651
+ /**
652
+ * Reindex slides after insertion/deletion.
653
+ */
654
+ private reindexSlides;
655
+ /**
656
+ * Count words in a slide.
657
+ */
658
+ private countWords;
659
+ /**
660
+ * Deep clone slides array.
661
+ */
662
+ private deepClone;
663
+ /**
664
+ * Generate remediation report.
665
+ */
666
+ generateReport(): string;
667
+ }
668
+
669
+ /**
670
+ * Hallucination Detector
671
+ *
672
+ * Verifies that all facts, statistics, and claims in the presentation
673
+ * are sourced from the original content. ZERO TOLERANCE for hallucinations.
674
+ *
675
+ * Checks:
676
+ * - Numbers and statistics must appear in source content
677
+ * - Company names must be in source content
678
+ * - Dates and timelines must be verifiable
679
+ * - Quotes must be exact matches
680
+ * - Claims must be supported by source material
681
+ *
682
+ * Philosophy: If it's not in the source, it shouldn't be in the presentation.
683
+ */
684
+
685
+ interface FactCheckResult {
686
+ passed: boolean;
687
+ score: number;
688
+ totalFacts: number;
689
+ verifiedFacts: number;
690
+ unverifiedFacts: number;
691
+ issues: FactCheckIssue[];
692
+ warnings: FactCheckWarning[];
693
+ }
694
+ interface FactCheckIssue {
695
+ slideIndex: number;
696
+ slideTitle: string;
697
+ fact: string;
698
+ type: 'number' | 'statistic' | 'company' | 'date' | 'quote' | 'claim';
699
+ severity: 'error' | 'warning';
700
+ message: string;
701
+ suggestion: string;
702
+ }
703
+ interface FactCheckWarning {
704
+ slideIndex: number;
705
+ message: string;
706
+ }
707
+ declare class HallucinationDetector {
708
+ private numberPattern;
709
+ private percentagePattern;
710
+ private datePattern;
711
+ private companyPattern;
712
+ private quotePattern;
713
+ /**
714
+ * Check all slides against source content for hallucinations.
715
+ */
716
+ checkForHallucinations(slides: Slide[], sourceContent: string, analysis: ContentAnalysis): Promise<FactCheckResult>;
717
+ /**
718
+ * Generate a fact-check report.
719
+ */
720
+ generateReport(result: FactCheckResult): string;
721
+ /**
722
+ * Auto-remediate hallucinations by removing unverified facts.
723
+ */
724
+ remediate(slides: Slide[], result: FactCheckResult): Slide[];
725
+ private normalizeText;
726
+ private getSlideText;
727
+ private extractNumbers;
728
+ private extractCompanies;
729
+ private extractDates;
730
+ private isNumberInSource;
731
+ private isCompanyInSource;
732
+ private isDateInSource;
733
+ private isCommonWord;
734
+ private checkForUnsupportedClaims;
735
+ private getPlaceholder;
736
+ }
737
+
295
738
  /**
296
739
  * Presentation Engine - Main Orchestrator
297
740
  *
298
741
  * Coordinates content analysis, slide generation, and QA validation
299
742
  * to produce world-class presentations.
743
+ *
744
+ * PHILOSOPHY: NEVER FAIL - ALWAYS DELIVER
745
+ *
746
+ * Instead of blocking on QA failures, this engine:
747
+ * 1. Validates the presentation
748
+ * 2. If issues found, automatically remediates them
749
+ * 3. Re-validates
750
+ * 4. Repeats until it passes (max 5 iterations)
751
+ * 5. ALWAYS delivers a working presentation
300
752
  */
301
753
 
302
754
  declare class PresentationEngine {
@@ -304,25 +756,38 @@ declare class PresentationEngine {
304
756
  private slideFactory;
305
757
  private templateEngine;
306
758
  private scoreCalculator;
759
+ private typeDetector;
760
+ private strategyFactory;
307
761
  private qaEngine;
762
+ private pptxValidator;
763
+ private htmlLayoutValidator;
764
+ private autoRemediation;
765
+ private hallucinationDetector;
308
766
  private htmlGenerator;
309
767
  private pptxGenerator;
310
768
  constructor();
311
769
  /**
312
770
  * Generate a presentation from content.
313
771
  *
772
+ * GUARANTEED DELIVERY:
773
+ * - Validates presentation quality
774
+ * - Automatically fixes any issues found
775
+ * - Iterates until quality threshold is met
776
+ * - ALWAYS returns a working presentation
777
+ *
314
778
  * @param config - Presentation configuration
315
779
  * @returns Presentation result with outputs, QA results, and score
316
780
  */
317
781
  generate(config: PresentationConfig): Promise<PresentationResult>;
318
782
  /**
319
- * Validate presentation configuration.
783
+ * Validate slides and automatically remediate until they pass.
784
+ * Includes hallucination detection to ensure all facts are sourced.
320
785
  */
321
- private validateConfig;
786
+ private validateAndRemediate;
322
787
  /**
323
- * Validate slide structure before generation.
788
+ * Validate presentation configuration.
324
789
  */
325
- private validateStructure;
790
+ private validateConfig;
326
791
  /**
327
792
  * Count words in a slide.
328
793
  */
@@ -335,6 +800,26 @@ declare class PresentationEngine {
335
800
  * Detect which expert frameworks were applied.
336
801
  */
337
802
  private detectFrameworks;
803
+ /**
804
+ * Get QA Engine for external access.
805
+ */
806
+ getQAEngine(): QAEngine;
807
+ /**
808
+ * Get PPTX Validator for external access.
809
+ */
810
+ getPPTXValidator(): PPTXValidator;
811
+ /**
812
+ * Get Score Calculator for external access.
813
+ */
814
+ getScoreCalculator(): ScoreCalculator;
815
+ /**
816
+ * Get Auto Remediation for external access.
817
+ */
818
+ getAutoRemediation(): AutoRemediation;
819
+ /**
820
+ * Get Hallucination Detector for external access.
821
+ */
822
+ getHallucinationDetector(): HallucinationDetector;
338
823
  }
339
824
 
340
825
  /**
@@ -427,17 +912,21 @@ declare class ContentAnalyzer {
427
912
  *
428
913
  * Generates slide structures based on:
429
914
  * - Presentation mode (keynote vs business)
915
+ * - Presentation type (7 specialized strategies)
430
916
  * - Content analysis results
431
917
  * - Expert methodology recommendations
432
918
  */
433
919
 
434
920
  declare class SlideFactory {
435
921
  private readonly templates;
922
+ private readonly strategyFactory;
436
923
  constructor();
437
924
  /**
438
925
  * Create slides from analyzed content.
926
+ * If presentationType is provided, uses the specialized strategy.
927
+ * Otherwise, falls back to mode-based generation.
439
928
  */
440
- createSlides(analysis: ContentAnalysis, mode: PresentationMode): Promise<Slide[]>;
929
+ createSlides(analysis: ContentAnalysis, mode: PresentationMode, presentationType?: PresentationType): Promise<Slide[]>;
441
930
  /**
442
931
  * Create a title slide.
443
932
  */
@@ -555,119 +1044,386 @@ declare class TemplateEngine {
555
1044
  }
556
1045
 
557
1046
  /**
558
- * Score Calculator - QA Score Computation
1047
+ * Accessibility Validator - WCAG Compliance Testing
559
1048
  *
560
- * Calculates presentation quality scores based on:
561
- * - Visual quality (35%)
562
- * - Content quality (30%)
563
- * - Expert methodology compliance (25%)
564
- * - Accessibility (10%)
1049
+ * Provides comprehensive accessibility validation using:
1050
+ * - Axe-core for automated WCAG testing
1051
+ * - Custom contrast ratio validation
1052
+ * - Font size compliance
1053
+ * - Keyboard navigation coverage
1054
+ * - Color-blind safety checks
1055
+ *
1056
+ * MANDATORY: All presentations must meet WCAG AA minimum.
565
1057
  */
566
1058
 
567
- interface ScoreBreakdown {
568
- visual: number;
569
- content: number;
570
- expert: number;
571
- accessibility: number;
572
- total: number;
573
- penalties: number;
574
- details: ScoreDetail[];
1059
+ interface A11yValidationResult {
1060
+ passed: boolean;
1061
+ wcagLevel: 'A' | 'AA' | 'AAA' | 'FAIL';
1062
+ score: number;
1063
+ issues: A11yIssue[];
1064
+ axeResults?: AxeResult[];
1065
+ contrastIssues: ContrastIssue[];
1066
+ fontSizeIssues: FontSizeIssue[];
1067
+ keyboardIssues: KeyboardIssue[];
1068
+ colorBlindSafe: boolean;
575
1069
  }
576
- interface ScoreDetail {
577
- category: string;
578
- check: string;
1070
+ interface A11yIssue {
1071
+ severity: 'critical' | 'serious' | 'moderate' | 'minor';
1072
+ type: 'contrast' | 'font-size' | 'keyboard' | 'aria' | 'structure' | 'color';
1073
+ slideIndex?: number;
1074
+ element?: string;
1075
+ message: string;
1076
+ wcagCriteria?: string;
1077
+ suggestion?: string;
1078
+ }
1079
+ interface AxeResult {
1080
+ id: string;
1081
+ impact: 'critical' | 'serious' | 'moderate' | 'minor';
1082
+ description: string;
1083
+ nodes: number;
1084
+ }
1085
+ interface KeyboardIssue {
1086
+ slideIndex: number;
1087
+ element: string;
1088
+ issue: string;
1089
+ }
1090
+ declare class AccessibilityValidator {
1091
+ private browser;
1092
+ /**
1093
+ * Validate accessibility of an HTML presentation.
1094
+ */
1095
+ validate(html: string, options?: {
1096
+ targetLevel?: 'A' | 'AA' | 'AAA';
1097
+ projectionMode?: boolean;
1098
+ }): Promise<A11yValidationResult>;
1099
+ /**
1100
+ * Check color contrast compliance.
1101
+ */
1102
+ private checkContrast;
1103
+ /**
1104
+ * Check font size compliance.
1105
+ */
1106
+ private checkFontSizes;
1107
+ /**
1108
+ * Check keyboard navigation accessibility.
1109
+ */
1110
+ private checkKeyboardNavigation;
1111
+ /**
1112
+ * Check document structure accessibility.
1113
+ */
1114
+ private checkStructure;
1115
+ /**
1116
+ * Check color-blind safety.
1117
+ */
1118
+ private checkColorBlindSafety;
1119
+ /**
1120
+ * Calculate contrast ratio between two colors.
1121
+ */
1122
+ private calculateContrastRatio;
1123
+ /**
1124
+ * Calculate relative luminance of a color.
1125
+ */
1126
+ private getRelativeLuminance;
1127
+ /**
1128
+ * Determine WCAG compliance level.
1129
+ */
1130
+ private determineWCAGLevel;
1131
+ /**
1132
+ * Calculate accessibility score.
1133
+ */
1134
+ private calculateScore;
1135
+ /**
1136
+ * Generate accessibility report.
1137
+ */
1138
+ generateReport(result: A11yValidationResult): string;
1139
+ private initBrowser;
1140
+ private closeBrowser;
1141
+ }
1142
+
1143
+ /**
1144
+ * HTML Layout Validator - Bulletproof Viewport Enforcement
1145
+ *
1146
+ * This validator TESTS rendered HTML presentations to VERIFY:
1147
+ * 1. No content overflows the slide boundaries
1148
+ * 2. All text is readable (not clipped)
1149
+ * 3. All elements fit within the viewport
1150
+ * 4. No horizontal scrolling is needed
1151
+ *
1152
+ * PHILOSOPHY: VERIFY, DON'T GUESS
1153
+ * - Uses Playwright to actually render the presentation
1154
+ * - Measures real DOM elements
1155
+ * - Checks computed styles
1156
+ * - Takes screenshots as evidence
1157
+ *
1158
+ * THIS IS MANDATORY - No HTML export without passing layout validation
1159
+ */
1160
+ interface LayoutValidationResult {
1161
+ passed: boolean;
579
1162
  score: number;
580
- maxScore: number;
581
- notes?: string;
1163
+ issues: LayoutIssue[];
1164
+ perSlide: SlideLayoutResult[];
1165
+ screenshots?: Buffer[];
582
1166
  }
583
- declare class ScoreCalculator {
584
- private readonly weights;
1167
+ interface LayoutIssue {
1168
+ severity: 'error' | 'warning' | 'info';
1169
+ slideIndex: number;
1170
+ element?: string;
1171
+ message: string;
1172
+ suggestion: string;
1173
+ measurements?: {
1174
+ elementWidth?: number;
1175
+ elementHeight?: number;
1176
+ viewportWidth?: number;
1177
+ viewportHeight?: number;
1178
+ overflow?: {
1179
+ x: number;
1180
+ y: number;
1181
+ };
1182
+ };
1183
+ }
1184
+ interface SlideLayoutResult {
1185
+ slideIndex: number;
1186
+ passed: boolean;
1187
+ score: number;
1188
+ issues: LayoutIssue[];
1189
+ measurements: {
1190
+ contentHeight: number;
1191
+ viewportHeight: number;
1192
+ contentWidth: number;
1193
+ viewportWidth: number;
1194
+ overflowY: number;
1195
+ overflowX: number;
1196
+ hasScrollbar: boolean;
1197
+ clippedElements: string[];
1198
+ };
1199
+ }
1200
+ declare class HTMLLayoutValidator {
1201
+ private playwright;
585
1202
  /**
586
- * Calculate overall QA score from results.
1203
+ * Validate HTML presentation layout using real browser rendering.
1204
+ * This is the MANDATORY check before any HTML export.
587
1205
  */
588
- calculate(results: QAResults): number;
1206
+ validate(html: string): Promise<LayoutValidationResult>;
589
1207
  /**
590
- * Get detailed score breakdown.
1208
+ * Validate a single slide's layout using Playwright.
591
1209
  */
592
- getBreakdown(results: QAResults): ScoreBreakdown;
1210
+ private validateSlide;
593
1211
  /**
594
- * Calculate visual quality score.
1212
+ * Static HTML analysis fallback when Playwright isn't available.
1213
+ * Analyzes CSS and HTML structure without rendering.
595
1214
  */
596
- private calculateVisualScore;
1215
+ private validateStaticHTML;
597
1216
  /**
598
- * Calculate content quality score.
1217
+ * Generate remediation suggestions for layout issues.
599
1218
  */
600
- private calculateContentScore;
1219
+ generateRemediationPlan(result: LayoutValidationResult): string[];
1220
+ }
1221
+
1222
+ /**
1223
+ * Presentation Type Detector
1224
+ *
1225
+ * Determines the appropriate presentation type based on:
1226
+ * 1. Explicit presentationType configuration
1227
+ * 2. Audience specification
1228
+ * 3. Goal specification
1229
+ * 4. Keyword analysis of content
1230
+ * 5. Legacy mode fallback
1231
+ *
1232
+ * Each presentation type has distinct validation rules that do not conflict.
1233
+ */
1234
+
1235
+ /**
1236
+ * Validation rules for each presentation type
1237
+ */
1238
+ declare const PRESENTATION_TYPE_RULES: Record<PresentationType, PresentationTypeRules>;
1239
+ declare class TypeDetector {
601
1240
  /**
602
- * Calculate expert methodology compliance score.
1241
+ * Detect the presentation type from configuration.
1242
+ * Priority:
1243
+ * 1. Explicit presentationType
1244
+ * 2. Audience mapping
1245
+ * 3. Goal mapping
1246
+ * 4. Content keyword analysis
1247
+ * 5. Legacy mode fallback
603
1248
  */
604
- private calculateExpertScore;
1249
+ detectType(config: PresentationConfig): PresentationType;
605
1250
  /**
606
- * Calculate accessibility compliance score.
1251
+ * Detect presentation type from keyword analysis.
607
1252
  */
608
- private calculateAccessibilityScore;
1253
+ private detectFromKeywords;
609
1254
  /**
610
- * Calculate penalties from issues.
1255
+ * Get validation rules for a presentation type.
611
1256
  */
612
- private calculatePenalties;
1257
+ getRules(type: PresentationType): PresentationTypeRules;
613
1258
  /**
614
- * Get human-readable grade from score.
1259
+ * Get all available presentation types.
615
1260
  */
616
- getGrade(score: number): string;
1261
+ getAvailableTypes(): PresentationType[];
617
1262
  /**
618
- * Get pass/fail status.
1263
+ * Map legacy mode to a presentation type.
619
1264
  */
620
- isPassing(score: number, threshold?: number): boolean;
1265
+ modeToType(mode: 'keynote' | 'business'): PresentationType;
621
1266
  /**
622
- * Format score for display.
1267
+ * Map presentation type back to legacy mode for compatibility.
623
1268
  */
624
- formatScore(score: number): string;
1269
+ typeToMode(type: PresentationType): 'keynote' | 'business';
625
1270
  /**
626
- * Generate summary report.
1271
+ * Get word limits for a presentation type.
627
1272
  */
628
- generateReport(results: QAResults): string;
1273
+ getWordLimits(type: PresentationType): {
1274
+ min: number;
1275
+ max: number;
1276
+ ideal: number;
1277
+ };
1278
+ /**
1279
+ * Check if action titles are required for a type.
1280
+ */
1281
+ requiresActionTitles(type: PresentationType): boolean;
1282
+ /**
1283
+ * Check if sources are required for a type.
1284
+ */
1285
+ requiresSources(type: PresentationType): boolean;
1286
+ /**
1287
+ * Get scoring weights for a presentation type.
1288
+ */
1289
+ getScoringWeights(type: PresentationType): {
1290
+ visual_quality: number;
1291
+ content_quality: number;
1292
+ expert_compliance: number;
1293
+ accessibility: number;
1294
+ };
629
1295
  }
630
1296
 
631
1297
  /**
632
- * QA Engine - Real Visual Quality Validation
1298
+ * Execution Strategy Types
633
1299
  *
634
- * Unlike fake validation systems, this engine ACTUALLY tests:
635
- * - Visual quality using Playwright screenshots + Canvas API
636
- * - Layout balance and whitespace distribution
637
- * - WCAG contrast compliance
638
- * - Expert methodology adherence
1300
+ * Types for the presentation execution strategy system.
639
1301
  */
640
1302
 
641
- declare class QAEngine {
642
- private browser;
1303
+ /**
1304
+ * A blueprint for a single slide in a presentation.
1305
+ */
1306
+ interface SlideBlueprint {
1307
+ /** Unique identifier for this slide in the sequence */
1308
+ id: string;
1309
+ /** Human-readable name */
1310
+ name: string;
1311
+ /** Slide type to use */
1312
+ type: SlideType;
1313
+ /** Is this slide required or optional? */
1314
+ required: boolean;
1315
+ /** Purpose of this slide (for content guidance) */
1316
+ purpose: string;
1317
+ /** Data fields this slide needs */
1318
+ requiredData: string[];
1319
+ /** Optional data fields */
1320
+ optionalData: string[];
1321
+ /** Word count constraints */
1322
+ wordLimits: {
1323
+ min: number;
1324
+ max: number;
1325
+ ideal: number;
1326
+ };
1327
+ /** Expert principles that apply to this slide */
1328
+ expertPrinciples: string[];
1329
+ /** Visual design notes */
1330
+ designNotes: string[];
1331
+ /** Example content (for guidance) */
1332
+ example?: {
1333
+ title?: string;
1334
+ subtitle?: string;
1335
+ bullets?: string[];
1336
+ body?: string;
1337
+ };
1338
+ }
1339
+ /**
1340
+ * A content transformation rule.
1341
+ */
1342
+ interface ContentTransform {
1343
+ /** What to look for in the source content */
1344
+ sourcePattern: string | RegExp;
1345
+ /** How to transform it */
1346
+ transform: (match: string, analysis: ContentAnalysis) => string;
1347
+ /** Description of the transformation */
1348
+ description: string;
1349
+ }
1350
+ /**
1351
+ * An execution strategy for a presentation type.
1352
+ */
1353
+ interface ExecutionStrategy {
1354
+ /** Presentation type this strategy is for */
1355
+ type: PresentationType;
1356
+ /** Human-readable name */
1357
+ name: string;
1358
+ /** Description */
1359
+ description: string;
1360
+ /** Expert methodologies to apply */
1361
+ experts: {
1362
+ primary: string;
1363
+ secondary: string[];
1364
+ };
1365
+ /** The slide sequence (ordered list of blueprints) */
1366
+ slideSequence: SlideBlueprint[];
1367
+ /** Content transformation rules */
1368
+ contentTransforms: ContentTransform[];
1369
+ /** Quality benchmarks */
1370
+ qualityBenchmarks: {
1371
+ minScore: number;
1372
+ criticalChecks: string[];
1373
+ excellenceIndicators: string[];
1374
+ };
643
1375
  /**
644
- * Validate a presentation.
1376
+ * Generate slides from content analysis.
645
1377
  */
646
- validate(presentation: string | Buffer, options?: {
647
- mode?: 'keynote' | 'business';
648
- strictMode?: boolean;
649
- threshold?: number;
650
- }): Promise<QAResults>;
1378
+ generateSlides(analysis: ContentAnalysis): Promise<Slide[]>;
651
1379
  /**
652
- * Calculate overall QA score.
1380
+ * Validate slides against this strategy's requirements.
653
1381
  */
654
- calculateScore(results: QAResults): number;
1382
+ validateSlides(slides: Slide[]): {
1383
+ passed: boolean;
1384
+ score: number;
1385
+ issues: string[];
1386
+ suggestions: string[];
1387
+ };
655
1388
  /**
656
- * Create empty QA results (for when QA is skipped).
1389
+ * Apply expert methodology transformations.
657
1390
  */
658
- createEmptyResults(): QAResults;
659
- private runVisualTests;
660
- private runContentTests;
661
- private runExpertTests;
662
- private createExpertResult;
663
- private runAccessibilityTests;
664
- private calculateVisualScore;
665
- private calculateContentScore;
666
- private calculateExpertScore;
667
- private calculateA11yScore;
668
- private collectIssues;
669
- private initBrowser;
670
- private closeBrowser;
1391
+ applyExpertMethodology(slides: Slide[]): Slide[];
1392
+ }
1393
+
1394
+ /**
1395
+ * Strategy Factory
1396
+ *
1397
+ * Selects the appropriate execution strategy based on presentation type.
1398
+ * Each strategy encapsulates world-class expertise for its domain.
1399
+ */
1400
+
1401
+ /**
1402
+ * Factory for creating presentation execution strategies.
1403
+ */
1404
+ declare class StrategyFactory {
1405
+ private strategies;
1406
+ constructor();
1407
+ /**
1408
+ * Get the execution strategy for a presentation type.
1409
+ */
1410
+ getStrategy(type: PresentationType): ExecutionStrategy;
1411
+ /**
1412
+ * Get all available strategies.
1413
+ */
1414
+ getAllStrategies(): ExecutionStrategy[];
1415
+ /**
1416
+ * Get strategy descriptions for user guidance.
1417
+ */
1418
+ getStrategyDescriptions(): Record<PresentationType, string>;
1419
+ /**
1420
+ * Get the primary expert for a presentation type.
1421
+ */
1422
+ getPrimaryExpert(type: PresentationType): string;
1423
+ /**
1424
+ * Get all experts for a presentation type.
1425
+ */
1426
+ getAllExperts(type: PresentationType): string[];
671
1427
  }
672
1428
 
673
1429
  /**
@@ -733,6 +1489,15 @@ declare class RevealJsGenerator {
733
1489
  * - Consistent styling
734
1490
  */
735
1491
 
1492
+ type PptxSlide = ReturnType<PptxGenJS['addSlide']>;
1493
+ declare const COLORS: {
1494
+ primary: string;
1495
+ secondary: string;
1496
+ accent: string;
1497
+ highlight: string;
1498
+ white: string;
1499
+ lightGray: string;
1500
+ };
736
1501
  declare class PowerPointGenerator {
737
1502
  private chartProvider;
738
1503
  /**
@@ -799,6 +1564,86 @@ declare class PowerPointGenerator {
799
1564
  * Convert layout position to PptxGenJS text props.
800
1565
  */
801
1566
  private positionToProps;
1567
+ /**
1568
+ * Add Football Field Valuation Chart (IB Standard)
1569
+ * Shows valuation ranges across different methodologies
1570
+ */
1571
+ addFootballFieldChart(pptxSlide: PptxSlide, data: {
1572
+ title: string;
1573
+ methodologies: Array<{
1574
+ name: string;
1575
+ low: number;
1576
+ mid: number;
1577
+ high: number;
1578
+ color?: string;
1579
+ }>;
1580
+ currentPrice?: number;
1581
+ }, bounds: {
1582
+ x: number;
1583
+ y: number;
1584
+ w: number;
1585
+ h: number;
1586
+ }, colors?: typeof COLORS): void;
1587
+ /**
1588
+ * Add Waterfall Chart (IB Standard)
1589
+ * Shows incremental changes leading to a final value
1590
+ */
1591
+ addWaterfallChart(pptxSlide: PptxSlide, data: {
1592
+ title: string;
1593
+ startLabel: string;
1594
+ startValue: number;
1595
+ steps: Array<{
1596
+ label: string;
1597
+ value: number;
1598
+ isTotal?: boolean;
1599
+ }>;
1600
+ endLabel?: string;
1601
+ }, bounds: {
1602
+ x: number;
1603
+ y: number;
1604
+ w: number;
1605
+ h: number;
1606
+ }, colors?: typeof COLORS): void;
1607
+ /**
1608
+ * Add Sources & Uses Table (IB Standard)
1609
+ * Common in M&A presentations
1610
+ */
1611
+ addSourcesUsesTable(pptxSlide: PptxSlide, data: {
1612
+ title: string;
1613
+ sources: Array<{
1614
+ label: string;
1615
+ amount: number;
1616
+ percentage?: number;
1617
+ }>;
1618
+ uses: Array<{
1619
+ label: string;
1620
+ amount: number;
1621
+ percentage?: number;
1622
+ }>;
1623
+ }, bounds: {
1624
+ x: number;
1625
+ y: number;
1626
+ w: number;
1627
+ h: number;
1628
+ }, colors?: typeof COLORS): void;
1629
+ /**
1630
+ * Add Comparable Companies Table (Comps - IB Standard)
1631
+ */
1632
+ addCompsTable(pptxSlide: PptxSlide, data: {
1633
+ title: string;
1634
+ columns: string[];
1635
+ companies: Array<{
1636
+ name: string;
1637
+ values: (string | number)[];
1638
+ highlight?: boolean;
1639
+ }>;
1640
+ medianRow?: boolean;
1641
+ }, bounds: {
1642
+ x: number;
1643
+ y: number;
1644
+ w: number;
1645
+ h: number;
1646
+ }, colors?: typeof COLORS): void;
802
1647
  }
803
1648
 
804
1649
  /**
@@ -1201,7 +2046,7 @@ declare function validate(presentation: string | Buffer, options?: {
1201
2046
  /**
1202
2047
  * Get the version of the package.
1203
2048
  */
1204
- declare const VERSION = "1.0.0";
2049
+ declare const VERSION = "2.0.0";
1205
2050
  /**
1206
2051
  * Default export for convenience.
1207
2052
  */
@@ -1210,7 +2055,9 @@ declare const _default: {
1210
2055
  validate: typeof validate;
1211
2056
  PresentationEngine: typeof PresentationEngine;
1212
2057
  QAEngine: typeof QAEngine;
2058
+ PPTXValidator: typeof PPTXValidator;
2059
+ AccessibilityValidator: typeof AccessibilityValidator;
1213
2060
  VERSION: string;
1214
2061
  };
1215
2062
 
1216
- export { type AccessibilityResults, type ChartData, type ChartDataset, ChartJsProvider, type ChartProvider, type ChartRequest, type ChartResult, type ChartType, CompositeChartProvider, CompositeImageProvider, type ContentAnalysis, ContentAnalyzer, type ContentQAResults, type ContrastIssue, type ExpertQAResults, type ExpertValidation, type FontSizeIssue, type GlanceTestResult, type ImageData, type ImageProvider, type ImageRequest, type ImageResult, KnowledgeBase, LocalImageProvider, MermaidProvider, type MetricData, type OneIdeaResult, type OutputFormat, PlaceholderImageProvider, PowerPointGenerator, type PresentationConfig, PresentationEngine, type PresentationMetadata, type PresentationMode, type PresentationResult, QAEngine, QAFailureError, type QAIssue, type QAResults, QuickChartProvider, RevealJsGenerator, type SCQAStructure, ScoreCalculator, type SignalNoiseResult, type Slide, type SlideContentScore, type SlideData, SlideFactory, type SlideType, type SlideVisualScore, type SparklineStructure, TemplateEngine, TemplateNotFoundError, type ThemeName, UnsplashImageProvider, VERSION, ValidationError, type VisualQAResults, createDefaultChartProvider, createDefaultImageProvider, _default as default, generate, getKnowledgeBase, validate };
2063
+ export { type AccessibilityResults, AccessibilityValidator, AutoRemediation, type ChartData, type ChartDataset, ChartJsProvider, type ChartProvider, type ChartRequest, type ChartResult, type ChartType, CompositeChartProvider, CompositeImageProvider, type ContentAnalysis, ContentAnalyzer, type ContentQAResults, type ContentTransform, type ContrastIssue, type ExecutionStrategy, type ExpertQAResults, type ExpertValidation, type FontSizeIssue, type GlanceTestResult, HTMLLayoutValidator, HallucinationDetector, type ImageData, type ImageProvider, type ImageRequest, type ImageResult, KnowledgeBase, LocalImageProvider, MermaidProvider, type MetricData, type OneIdeaResult, type OutputFormat, PPTXValidator, PRESENTATION_TYPE_RULES, PlaceholderImageProvider, PowerPointGenerator, type PresentationConfig, PresentationEngine, type PresentationMetadata, type PresentationMode, type PresentationResult, type PresentationType, type PresentationTypeRules, QAEngine, QAFailureError, type QAIssue, type QAResults, QuickChartProvider, RevealJsGenerator, type SCQAStructure, ScoreCalculator, type SignalNoiseResult, type Slide, type SlideBlueprint, type SlideContentScore, type SlideData, SlideFactory, type SlideType, type SlideVisualScore, type SparklineStructure, StrategyFactory, TemplateEngine, TemplateNotFoundError, type ThemeName, TypeDetector, UnsplashImageProvider, VERSION, ValidationError, type VisualQAResults, createDefaultChartProvider, createDefaultImageProvider, _default as default, generate, getKnowledgeBase, validate };