claude-presentation-master 4.1.0 → 4.3.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
@@ -20,7 +20,7 @@ const args = process.argv.slice(2);
20
20
 
21
21
  // Help text
22
22
  const helpText = `
23
- Claude Presentation Master v4.1.0
23
+ Claude Presentation Master v4.2.0
24
24
  Generate world-class presentations using expert methodologies
25
25
 
26
26
  100% FREE • Zero API Keys • Runs Locally
@@ -85,7 +85,7 @@ For more information: https://github.com/Stuinfla/claude-presentation-master
85
85
  `;
86
86
 
87
87
  // Version
88
- const version = '4.1.0';
88
+ const version = '4.2.0';
89
89
 
90
90
  // Parse arguments
91
91
  function parseArgs(args) {
package/dist/index.d.mts CHANGED
@@ -538,7 +538,10 @@ declare function initContentAnalyzer(): Promise<ContentAnalyzer>;
538
538
  * - Respect for KB word limits and rules
539
539
  * - SCQA/Sparkline narrative structure when detected
540
540
  *
541
- * ALL decisions come from the Knowledge Base. NO hardcoded fallbacks.
541
+ * DESIGN PHILOSOPHY:
542
+ * - All type-specific rules (word limits, allowed slide types) come from KB
543
+ * - Defensive fallbacks exist for edge cases (e.g., bullet limit defaults to 5)
544
+ * - Slide structure decisions (agenda, section dividers) are algorithmic
542
545
  */
543
546
 
544
547
  declare class SlideGenerator {
@@ -787,26 +790,37 @@ declare class SlideGeneratorV2 {
787
790
  declare function createSlideGeneratorV2(type?: PresentationType): SlideGeneratorV2;
788
791
 
789
792
  /**
790
- * Renderer V2 - Clean, Professional, No Garbage
793
+ * Renderer V2 - KB-Driven Visual Excellence
791
794
  *
792
795
  * Renders slides to HTML and PDF with:
793
796
  * - Tables as actual tables (not mangled metrics)
794
797
  * - Complete bullets (never truncated)
795
798
  * - Clean professional CSS (no random stock photos)
796
- * - McKinsey/BCG consulting style (WHITE background, strong hierarchy)
799
+ * - Color palettes loaded from Knowledge Base per presentation type
800
+ * - Typography and spacing from KB
797
801
  * - Automatic PDF generation alongside HTML
798
802
  */
799
803
 
800
- type ThemeStyle = 'mckinsey' | 'dark' | 'minimal' | 'corporate' | 'startup';
804
+ type ThemeStyle = 'light' | 'dark';
801
805
  declare class RendererV2 {
802
806
  private theme;
803
807
  private presentationType;
808
+ private kb;
809
+ /**
810
+ * Create renderer with theme loaded from Knowledge Base.
811
+ * @param presentationType - The type of deck being created (determines palette)
812
+ * @param kb - Knowledge Base gateway (optional, will use global if not provided)
813
+ */
814
+ constructor(presentationType?: PresentationType, kb?: KnowledgeGateway);
815
+ /**
816
+ * Load theme configuration from Knowledge Base.
817
+ * Falls back to hardcoded values only if KB fails.
818
+ */
819
+ private loadThemeFromKB;
804
820
  /**
805
- * Create renderer with theme based on presentation type.
806
- * @param presentationType - The type of deck being created (determines theme)
807
- * @param themeOverride - Optional explicit theme override
821
+ * Default palette mapping per presentation type (used if KB doesn't specify).
808
822
  */
809
- constructor(presentationType?: PresentationType, themeOverride?: ThemeStyle);
823
+ private getDefaultPaletteName;
810
824
  /**
811
825
  * Render slides to complete HTML document.
812
826
  */
@@ -829,9 +843,9 @@ declare class RendererV2 {
829
843
  */
830
844
  private renderForPrint;
831
845
  /**
832
- * McKinsey-style print HTML (white background, professional).
846
+ * Light theme print HTML (professional, white background).
833
847
  */
834
- private getMcKinseyPrintHTML;
848
+ private getLightPrintHTML;
835
849
  /**
836
850
  * Dark theme print HTML (legacy).
837
851
  */
@@ -889,17 +903,25 @@ declare class RendererV2 {
889
903
  */
890
904
  private escapeHtml;
891
905
  /**
892
- * Professional CSS - McKinsey/BCG consulting style.
906
+ * Generate CSS with colors from Knowledge Base.
893
907
  */
894
908
  private getCSS;
895
909
  /**
896
- * McKinsey/BCG Consulting Style - WHITE background, professional hierarchy.
910
+ * Generate CSS variables from KB palette.
911
+ */
912
+ private getCSSVariables;
913
+ /**
914
+ * Lighten or darken a hex color.
915
+ */
916
+ private lightenColor;
917
+ /**
918
+ * Light theme CSS (consulting style) with KB palette colors.
897
919
  */
898
- private getMcKinseyCSS;
920
+ private getLightThemeCSS;
899
921
  /**
900
- * Dark theme CSS (legacy).
922
+ * Dark theme CSS with KB palette colors.
901
923
  */
902
- private getDarkCSS;
924
+ private getDarkThemeCSS;
903
925
  }
904
926
  /**
905
927
  * Create a renderer with theme matched to the presentation type.
@@ -914,7 +936,151 @@ declare class RendererV2 {
914
936
  * - product_demo, investor_pitch → Startup (modern dark)
915
937
  * - executive_briefing → Corporate (professional)
916
938
  */
917
- declare function createRendererV2(presentationType?: PresentationType, themeOverride?: ThemeStyle): RendererV2;
939
+ declare function createRendererV2(presentationType?: PresentationType, kb?: KnowledgeGateway): RendererV2;
940
+
941
+ /**
942
+ * VisualQAEngine - REAL Visual Quality Assurance
943
+ *
944
+ * This is NOT a rule checker. This SEES the actual rendered presentation.
945
+ *
946
+ * How it works:
947
+ * 1. Playwright renders the HTML presentation
948
+ * 2. Screenshots each slide at 1920x1080
949
+ * 3. Analyzes screenshots with:
950
+ * - Pixel-based whitespace calculation
951
+ * - Color contrast checking (WCAG)
952
+ * - Text density measurement
953
+ * - Visual balance assessment
954
+ * 4. Vision API for qualitative "would you present this?" check
955
+ * 5. Scores against KB criteria
956
+ * 6. Provides specific visual feedback
957
+ * 7. Loops until 95+ or max iterations
958
+ *
959
+ * This is the REAL QA that evaluates what the audience SEES.
960
+ */
961
+
962
+ interface VisualSlideAnalysis {
963
+ slideIndex: number;
964
+ title: string;
965
+ screenshot: Buffer;
966
+ whitespacePercentage: number;
967
+ textDensity: number;
968
+ colorContrast: number;
969
+ visualBalance: number;
970
+ glanceTestPassed: boolean;
971
+ hierarchyClear: boolean;
972
+ professionalLook: boolean;
973
+ score: number;
974
+ issues: VisualIssue[];
975
+ passed: boolean;
976
+ }
977
+ interface VisualIssue {
978
+ severity: 'critical' | 'major' | 'minor';
979
+ category: 'whitespace' | 'contrast' | 'density' | 'balance' | 'hierarchy' | 'professional';
980
+ issue: string;
981
+ measurement?: number;
982
+ threshold?: number;
983
+ fix: string;
984
+ }
985
+ interface VisualDeckAnalysis {
986
+ slides: VisualSlideAnalysis[];
987
+ overallScore: number;
988
+ passed: boolean;
989
+ consistency: number;
990
+ deckIssues: string[];
991
+ summary: string;
992
+ }
993
+ interface RemediationFeedback {
994
+ slideIndex: number;
995
+ currentScore: number;
996
+ targetScore: number;
997
+ specificFixes: string[];
998
+ visualProblems: string[];
999
+ }
1000
+ interface QALoopResult {
1001
+ finalScore: number;
1002
+ passed: boolean;
1003
+ iterations: number;
1004
+ initialScore: number;
1005
+ improvements: string[];
1006
+ finalAnalysis: VisualDeckAnalysis;
1007
+ }
1008
+ declare class VisualQAEngine {
1009
+ private kb;
1010
+ private browser;
1011
+ private initialized;
1012
+ private minWhitespace;
1013
+ private minContrast;
1014
+ private maxWordsPerSlide;
1015
+ private targetScore;
1016
+ constructor();
1017
+ /**
1018
+ * Initialize Playwright browser.
1019
+ */
1020
+ initialize(): Promise<void>;
1021
+ /**
1022
+ * Load quality thresholds from Knowledge Base.
1023
+ */
1024
+ private loadKBThresholds;
1025
+ /**
1026
+ * Capture screenshots of all slides in a presentation.
1027
+ */
1028
+ captureSlides(html: string): Promise<Buffer[]>;
1029
+ /**
1030
+ * Analyze a single slide screenshot.
1031
+ */
1032
+ analyzeSlide(screenshot: Buffer, slideIndex: number, slideTitle: string, presentationType: PresentationType): Promise<VisualSlideAnalysis>;
1033
+ /**
1034
+ * Analyze entire deck visually.
1035
+ */
1036
+ analyzeDeck(html: string, slides: SlideV2[], presentationType: PresentationType): Promise<VisualDeckAnalysis>;
1037
+ /**
1038
+ * Generate remediation feedback for failing slides.
1039
+ */
1040
+ generateRemediationFeedback(analysis: VisualDeckAnalysis): RemediationFeedback[];
1041
+ /**
1042
+ * Run the full QA loop until passing or max iterations.
1043
+ */
1044
+ runQALoop(generateFn: () => Promise<{
1045
+ html: string;
1046
+ slides: SlideV2[];
1047
+ }>, remediateFn: (feedback: RemediationFeedback[]) => Promise<void>, presentationType: PresentationType, maxIterations?: number): Promise<QALoopResult>;
1048
+ /**
1049
+ * Close browser and cleanup.
1050
+ */
1051
+ cleanup(): Promise<void>;
1052
+ /**
1053
+ * Measure whitespace percentage from screenshot.
1054
+ * Uses actual pixel analysis.
1055
+ */
1056
+ private measureWhitespace;
1057
+ /**
1058
+ * Measure color contrast ratio.
1059
+ */
1060
+ private measureContrast;
1061
+ /**
1062
+ * Measure text density (approximation based on non-background pixels).
1063
+ */
1064
+ private measureTextDensity;
1065
+ /**
1066
+ * Measure visual balance (how evenly distributed is the content).
1067
+ * Uses a 3x3 grid to properly detect centered layouts (common in keynotes).
1068
+ */
1069
+ private measureBalance;
1070
+ /**
1071
+ * Check if there's clear visual hierarchy.
1072
+ */
1073
+ private checkHierarchy;
1074
+ private getTypeThresholds;
1075
+ private detectBackgroundColor;
1076
+ private detectTextColor;
1077
+ private isSimilarColor;
1078
+ private relativeLuminance;
1079
+ private calculateConsistency;
1080
+ private variance;
1081
+ }
1082
+ declare function getVisualQAEngine(): VisualQAEngine;
1083
+ declare function initVisualQAEngine(): Promise<VisualQAEngine>;
918
1084
 
919
1085
  /**
920
1086
  * PresentationEngineV2 - Knowledge-Driven Excellence
@@ -927,9 +1093,14 @@ declare function createRendererV2(presentationType?: PresentationType, themeOver
927
1093
  * 5. Review ruthlessly (must score 95/100+)
928
1094
  * 6. Output ONLY if quality passes
929
1095
  *
930
- * CRITICAL: The Knowledge Base drives EVERYTHING.
931
- * The KnowledgeGateway reads from presentation-knowledge.yaml at runtime.
932
- * NO hardcoded fallbacks - if KB is missing data, we fail loudly.
1096
+ * DESIGN PHILOSOPHY:
1097
+ * - The Knowledge Base (YAML) is the single source of truth for all design decisions
1098
+ * - Uses KnowledgeGateway.queryRequired() for critical paths (throws on missing data)
1099
+ * - Defensive fallbacks exist only for:
1100
+ * 1. Optional fields that may not exist in older KB versions
1101
+ * 2. Type coercion safety (undefined → default string)
1102
+ * 3. Map lookups that might fail for new palette names
1103
+ * - Critical errors (missing presentation types, validation rules) will throw
933
1104
  */
934
1105
 
935
1106
  interface DesignSpecs {
@@ -992,6 +1163,14 @@ interface EngineOptions {
992
1163
  verbose?: boolean;
993
1164
  /** Maximum remediation attempts per slide */
994
1165
  maxRemediationAttempts?: number;
1166
+ /** Run visual QA analysis using Playwright screenshots (default: false) */
1167
+ runVisualQA?: boolean;
1168
+ /**
1169
+ * Use V1's richer slide generation pipeline (default: true)
1170
+ * V1 creates agenda, section dividers, SCQA structure, metrics, STAR moments, call-to-action
1171
+ * V2 is minimalist - just sections parsed from markdown
1172
+ */
1173
+ useRichPipeline?: boolean;
995
1174
  }
996
1175
  interface EngineResult {
997
1176
  slides: SlideV2[];
@@ -1001,6 +1180,8 @@ interface EngineResult {
1001
1180
  designSpecs: DesignSpecs;
1002
1181
  review: DeckReview;
1003
1182
  warnings: string[];
1183
+ /** Visual QA analysis (only present if runVisualQA option is true) */
1184
+ visualQA?: VisualDeckAnalysis;
1004
1185
  }
1005
1186
  declare class PresentationEngineV2 {
1006
1187
  private options;
@@ -1783,10 +1964,14 @@ declare function runCodeQualityCheck(srcDir: string): Promise<boolean>;
1783
1964
  * 5. DeckQualityReviewer -> Holistic deck review (must pass 95)
1784
1965
  * 6. Renderer -> Premium HTML/PPTX output
1785
1966
  *
1786
- * ALL decisions come from the Knowledge Base. NO hardcoded fallbacks.
1967
+ * DESIGN PHILOSOPHY:
1968
+ * - The Knowledge Base (YAML) is the source of truth for all design decisions
1969
+ * - Critical paths use queryRequired() which throws on missing data
1970
+ * - Defensive fallbacks exist for optional fields and type safety
1971
+ * - Both V1 (generate) and V2 (generatePresentation) APIs use the same KB
1787
1972
  */
1788
1973
 
1789
- declare const VERSION = "4.1.0";
1974
+ declare const VERSION = "4.2.0";
1790
1975
  interface GenerateOptions {
1791
1976
  /** Input content (Markdown, text, etc.) */
1792
1977
  content: string;
@@ -1855,4 +2040,4 @@ interface GenerateResult {
1855
2040
  */
1856
2041
  declare function generate(options: GenerateOptions): Promise<GenerateResult>;
1857
2042
 
1858
- export { CodeQualityValidator, type ValidationResult as CodeValidationResult, type ContentAnalysis, ContentAnalyzer, DeckQualityReviewer, type DeckScore, type GenerateOptions, type GenerateResult, type HardcodedViolation, type ImageGenerationRequest, type ImageGenerationResult, KnowledgeGateway, type MetricData, type NanoBananaConfig, NanoBananaProvider, type OutputFormat, PresentationEngineV2, type PresentationMetadata, type PresentationMode, type PresentationResult, type PresentationType, type QualitativeDeckReview, type QualitativeSlideReview, type RemediationResult, Remediator, Renderer, RendererV2, type Slide, type SlideContent as SlideContentV2, SlideGenerator, SlideGeneratorV2, SlideQualityReviewer, type SlideScore, type SlideType as SlideTypeV2, type SlideV2, type TableData, VERSION, type Violation, VisualDesignSystem, createNanoBananaProvider, createPresentationEngineV2, createRendererV2, createSlideGeneratorV2, generate, generatePresentation, getContentAnalyzer, getDeckQualityReviewer, getKB, getNanoBananaPrompt, getRemediator, getRenderer, getSlideGenerator, getSlideQualityReviewer, getVisualDesignSystem, initContentAnalyzer, initDeckQualityReviewer, initKB, initRemediator, initRenderer, initSlideGenerator, initSlideQualityReviewer, initVisualDesignSystem, runCodeQualityCheck, validateCodeQuality };
2043
+ export { CodeQualityValidator, type ValidationResult as CodeValidationResult, type ContentAnalysis, ContentAnalyzer, DeckQualityReviewer, type DeckScore, type GenerateOptions, type GenerateResult, type HardcodedViolation, type ImageGenerationRequest, type ImageGenerationResult, KnowledgeGateway, type MetricData, type NanoBananaConfig, NanoBananaProvider, type OutputFormat, PresentationEngineV2, type PresentationMetadata, type PresentationMode, type PresentationResult, type PresentationType, type QALoopResult, type QualitativeDeckReview, type QualitativeSlideReview, type RemediationFeedback, type RemediationResult, Remediator, Renderer, RendererV2, type Slide, type SlideContent as SlideContentV2, SlideGenerator, SlideGeneratorV2, SlideQualityReviewer, type SlideScore, type SlideType as SlideTypeV2, type SlideV2, type TableData, VERSION, type Violation, type VisualDeckAnalysis, VisualDesignSystem, VisualQAEngine, type VisualSlideAnalysis, createNanoBananaProvider, createPresentationEngineV2, createRendererV2, createSlideGeneratorV2, generate, generatePresentation, getContentAnalyzer, getDeckQualityReviewer, getKB, getNanoBananaPrompt, getRemediator, getRenderer, getSlideGenerator, getSlideQualityReviewer, getVisualDesignSystem, getVisualQAEngine, initContentAnalyzer, initDeckQualityReviewer, initKB, initRemediator, initRenderer, initSlideGenerator, initSlideQualityReviewer, initVisualDesignSystem, initVisualQAEngine, runCodeQualityCheck, validateCodeQuality };
package/dist/index.d.ts CHANGED
@@ -538,7 +538,10 @@ declare function initContentAnalyzer(): Promise<ContentAnalyzer>;
538
538
  * - Respect for KB word limits and rules
539
539
  * - SCQA/Sparkline narrative structure when detected
540
540
  *
541
- * ALL decisions come from the Knowledge Base. NO hardcoded fallbacks.
541
+ * DESIGN PHILOSOPHY:
542
+ * - All type-specific rules (word limits, allowed slide types) come from KB
543
+ * - Defensive fallbacks exist for edge cases (e.g., bullet limit defaults to 5)
544
+ * - Slide structure decisions (agenda, section dividers) are algorithmic
542
545
  */
543
546
 
544
547
  declare class SlideGenerator {
@@ -787,26 +790,37 @@ declare class SlideGeneratorV2 {
787
790
  declare function createSlideGeneratorV2(type?: PresentationType): SlideGeneratorV2;
788
791
 
789
792
  /**
790
- * Renderer V2 - Clean, Professional, No Garbage
793
+ * Renderer V2 - KB-Driven Visual Excellence
791
794
  *
792
795
  * Renders slides to HTML and PDF with:
793
796
  * - Tables as actual tables (not mangled metrics)
794
797
  * - Complete bullets (never truncated)
795
798
  * - Clean professional CSS (no random stock photos)
796
- * - McKinsey/BCG consulting style (WHITE background, strong hierarchy)
799
+ * - Color palettes loaded from Knowledge Base per presentation type
800
+ * - Typography and spacing from KB
797
801
  * - Automatic PDF generation alongside HTML
798
802
  */
799
803
 
800
- type ThemeStyle = 'mckinsey' | 'dark' | 'minimal' | 'corporate' | 'startup';
804
+ type ThemeStyle = 'light' | 'dark';
801
805
  declare class RendererV2 {
802
806
  private theme;
803
807
  private presentationType;
808
+ private kb;
809
+ /**
810
+ * Create renderer with theme loaded from Knowledge Base.
811
+ * @param presentationType - The type of deck being created (determines palette)
812
+ * @param kb - Knowledge Base gateway (optional, will use global if not provided)
813
+ */
814
+ constructor(presentationType?: PresentationType, kb?: KnowledgeGateway);
815
+ /**
816
+ * Load theme configuration from Knowledge Base.
817
+ * Falls back to hardcoded values only if KB fails.
818
+ */
819
+ private loadThemeFromKB;
804
820
  /**
805
- * Create renderer with theme based on presentation type.
806
- * @param presentationType - The type of deck being created (determines theme)
807
- * @param themeOverride - Optional explicit theme override
821
+ * Default palette mapping per presentation type (used if KB doesn't specify).
808
822
  */
809
- constructor(presentationType?: PresentationType, themeOverride?: ThemeStyle);
823
+ private getDefaultPaletteName;
810
824
  /**
811
825
  * Render slides to complete HTML document.
812
826
  */
@@ -829,9 +843,9 @@ declare class RendererV2 {
829
843
  */
830
844
  private renderForPrint;
831
845
  /**
832
- * McKinsey-style print HTML (white background, professional).
846
+ * Light theme print HTML (professional, white background).
833
847
  */
834
- private getMcKinseyPrintHTML;
848
+ private getLightPrintHTML;
835
849
  /**
836
850
  * Dark theme print HTML (legacy).
837
851
  */
@@ -889,17 +903,25 @@ declare class RendererV2 {
889
903
  */
890
904
  private escapeHtml;
891
905
  /**
892
- * Professional CSS - McKinsey/BCG consulting style.
906
+ * Generate CSS with colors from Knowledge Base.
893
907
  */
894
908
  private getCSS;
895
909
  /**
896
- * McKinsey/BCG Consulting Style - WHITE background, professional hierarchy.
910
+ * Generate CSS variables from KB palette.
911
+ */
912
+ private getCSSVariables;
913
+ /**
914
+ * Lighten or darken a hex color.
915
+ */
916
+ private lightenColor;
917
+ /**
918
+ * Light theme CSS (consulting style) with KB palette colors.
897
919
  */
898
- private getMcKinseyCSS;
920
+ private getLightThemeCSS;
899
921
  /**
900
- * Dark theme CSS (legacy).
922
+ * Dark theme CSS with KB palette colors.
901
923
  */
902
- private getDarkCSS;
924
+ private getDarkThemeCSS;
903
925
  }
904
926
  /**
905
927
  * Create a renderer with theme matched to the presentation type.
@@ -914,7 +936,151 @@ declare class RendererV2 {
914
936
  * - product_demo, investor_pitch → Startup (modern dark)
915
937
  * - executive_briefing → Corporate (professional)
916
938
  */
917
- declare function createRendererV2(presentationType?: PresentationType, themeOverride?: ThemeStyle): RendererV2;
939
+ declare function createRendererV2(presentationType?: PresentationType, kb?: KnowledgeGateway): RendererV2;
940
+
941
+ /**
942
+ * VisualQAEngine - REAL Visual Quality Assurance
943
+ *
944
+ * This is NOT a rule checker. This SEES the actual rendered presentation.
945
+ *
946
+ * How it works:
947
+ * 1. Playwright renders the HTML presentation
948
+ * 2. Screenshots each slide at 1920x1080
949
+ * 3. Analyzes screenshots with:
950
+ * - Pixel-based whitespace calculation
951
+ * - Color contrast checking (WCAG)
952
+ * - Text density measurement
953
+ * - Visual balance assessment
954
+ * 4. Vision API for qualitative "would you present this?" check
955
+ * 5. Scores against KB criteria
956
+ * 6. Provides specific visual feedback
957
+ * 7. Loops until 95+ or max iterations
958
+ *
959
+ * This is the REAL QA that evaluates what the audience SEES.
960
+ */
961
+
962
+ interface VisualSlideAnalysis {
963
+ slideIndex: number;
964
+ title: string;
965
+ screenshot: Buffer;
966
+ whitespacePercentage: number;
967
+ textDensity: number;
968
+ colorContrast: number;
969
+ visualBalance: number;
970
+ glanceTestPassed: boolean;
971
+ hierarchyClear: boolean;
972
+ professionalLook: boolean;
973
+ score: number;
974
+ issues: VisualIssue[];
975
+ passed: boolean;
976
+ }
977
+ interface VisualIssue {
978
+ severity: 'critical' | 'major' | 'minor';
979
+ category: 'whitespace' | 'contrast' | 'density' | 'balance' | 'hierarchy' | 'professional';
980
+ issue: string;
981
+ measurement?: number;
982
+ threshold?: number;
983
+ fix: string;
984
+ }
985
+ interface VisualDeckAnalysis {
986
+ slides: VisualSlideAnalysis[];
987
+ overallScore: number;
988
+ passed: boolean;
989
+ consistency: number;
990
+ deckIssues: string[];
991
+ summary: string;
992
+ }
993
+ interface RemediationFeedback {
994
+ slideIndex: number;
995
+ currentScore: number;
996
+ targetScore: number;
997
+ specificFixes: string[];
998
+ visualProblems: string[];
999
+ }
1000
+ interface QALoopResult {
1001
+ finalScore: number;
1002
+ passed: boolean;
1003
+ iterations: number;
1004
+ initialScore: number;
1005
+ improvements: string[];
1006
+ finalAnalysis: VisualDeckAnalysis;
1007
+ }
1008
+ declare class VisualQAEngine {
1009
+ private kb;
1010
+ private browser;
1011
+ private initialized;
1012
+ private minWhitespace;
1013
+ private minContrast;
1014
+ private maxWordsPerSlide;
1015
+ private targetScore;
1016
+ constructor();
1017
+ /**
1018
+ * Initialize Playwright browser.
1019
+ */
1020
+ initialize(): Promise<void>;
1021
+ /**
1022
+ * Load quality thresholds from Knowledge Base.
1023
+ */
1024
+ private loadKBThresholds;
1025
+ /**
1026
+ * Capture screenshots of all slides in a presentation.
1027
+ */
1028
+ captureSlides(html: string): Promise<Buffer[]>;
1029
+ /**
1030
+ * Analyze a single slide screenshot.
1031
+ */
1032
+ analyzeSlide(screenshot: Buffer, slideIndex: number, slideTitle: string, presentationType: PresentationType): Promise<VisualSlideAnalysis>;
1033
+ /**
1034
+ * Analyze entire deck visually.
1035
+ */
1036
+ analyzeDeck(html: string, slides: SlideV2[], presentationType: PresentationType): Promise<VisualDeckAnalysis>;
1037
+ /**
1038
+ * Generate remediation feedback for failing slides.
1039
+ */
1040
+ generateRemediationFeedback(analysis: VisualDeckAnalysis): RemediationFeedback[];
1041
+ /**
1042
+ * Run the full QA loop until passing or max iterations.
1043
+ */
1044
+ runQALoop(generateFn: () => Promise<{
1045
+ html: string;
1046
+ slides: SlideV2[];
1047
+ }>, remediateFn: (feedback: RemediationFeedback[]) => Promise<void>, presentationType: PresentationType, maxIterations?: number): Promise<QALoopResult>;
1048
+ /**
1049
+ * Close browser and cleanup.
1050
+ */
1051
+ cleanup(): Promise<void>;
1052
+ /**
1053
+ * Measure whitespace percentage from screenshot.
1054
+ * Uses actual pixel analysis.
1055
+ */
1056
+ private measureWhitespace;
1057
+ /**
1058
+ * Measure color contrast ratio.
1059
+ */
1060
+ private measureContrast;
1061
+ /**
1062
+ * Measure text density (approximation based on non-background pixels).
1063
+ */
1064
+ private measureTextDensity;
1065
+ /**
1066
+ * Measure visual balance (how evenly distributed is the content).
1067
+ * Uses a 3x3 grid to properly detect centered layouts (common in keynotes).
1068
+ */
1069
+ private measureBalance;
1070
+ /**
1071
+ * Check if there's clear visual hierarchy.
1072
+ */
1073
+ private checkHierarchy;
1074
+ private getTypeThresholds;
1075
+ private detectBackgroundColor;
1076
+ private detectTextColor;
1077
+ private isSimilarColor;
1078
+ private relativeLuminance;
1079
+ private calculateConsistency;
1080
+ private variance;
1081
+ }
1082
+ declare function getVisualQAEngine(): VisualQAEngine;
1083
+ declare function initVisualQAEngine(): Promise<VisualQAEngine>;
918
1084
 
919
1085
  /**
920
1086
  * PresentationEngineV2 - Knowledge-Driven Excellence
@@ -927,9 +1093,14 @@ declare function createRendererV2(presentationType?: PresentationType, themeOver
927
1093
  * 5. Review ruthlessly (must score 95/100+)
928
1094
  * 6. Output ONLY if quality passes
929
1095
  *
930
- * CRITICAL: The Knowledge Base drives EVERYTHING.
931
- * The KnowledgeGateway reads from presentation-knowledge.yaml at runtime.
932
- * NO hardcoded fallbacks - if KB is missing data, we fail loudly.
1096
+ * DESIGN PHILOSOPHY:
1097
+ * - The Knowledge Base (YAML) is the single source of truth for all design decisions
1098
+ * - Uses KnowledgeGateway.queryRequired() for critical paths (throws on missing data)
1099
+ * - Defensive fallbacks exist only for:
1100
+ * 1. Optional fields that may not exist in older KB versions
1101
+ * 2. Type coercion safety (undefined → default string)
1102
+ * 3. Map lookups that might fail for new palette names
1103
+ * - Critical errors (missing presentation types, validation rules) will throw
933
1104
  */
934
1105
 
935
1106
  interface DesignSpecs {
@@ -992,6 +1163,14 @@ interface EngineOptions {
992
1163
  verbose?: boolean;
993
1164
  /** Maximum remediation attempts per slide */
994
1165
  maxRemediationAttempts?: number;
1166
+ /** Run visual QA analysis using Playwright screenshots (default: false) */
1167
+ runVisualQA?: boolean;
1168
+ /**
1169
+ * Use V1's richer slide generation pipeline (default: true)
1170
+ * V1 creates agenda, section dividers, SCQA structure, metrics, STAR moments, call-to-action
1171
+ * V2 is minimalist - just sections parsed from markdown
1172
+ */
1173
+ useRichPipeline?: boolean;
995
1174
  }
996
1175
  interface EngineResult {
997
1176
  slides: SlideV2[];
@@ -1001,6 +1180,8 @@ interface EngineResult {
1001
1180
  designSpecs: DesignSpecs;
1002
1181
  review: DeckReview;
1003
1182
  warnings: string[];
1183
+ /** Visual QA analysis (only present if runVisualQA option is true) */
1184
+ visualQA?: VisualDeckAnalysis;
1004
1185
  }
1005
1186
  declare class PresentationEngineV2 {
1006
1187
  private options;
@@ -1783,10 +1964,14 @@ declare function runCodeQualityCheck(srcDir: string): Promise<boolean>;
1783
1964
  * 5. DeckQualityReviewer -> Holistic deck review (must pass 95)
1784
1965
  * 6. Renderer -> Premium HTML/PPTX output
1785
1966
  *
1786
- * ALL decisions come from the Knowledge Base. NO hardcoded fallbacks.
1967
+ * DESIGN PHILOSOPHY:
1968
+ * - The Knowledge Base (YAML) is the source of truth for all design decisions
1969
+ * - Critical paths use queryRequired() which throws on missing data
1970
+ * - Defensive fallbacks exist for optional fields and type safety
1971
+ * - Both V1 (generate) and V2 (generatePresentation) APIs use the same KB
1787
1972
  */
1788
1973
 
1789
- declare const VERSION = "4.1.0";
1974
+ declare const VERSION = "4.2.0";
1790
1975
  interface GenerateOptions {
1791
1976
  /** Input content (Markdown, text, etc.) */
1792
1977
  content: string;
@@ -1855,4 +2040,4 @@ interface GenerateResult {
1855
2040
  */
1856
2041
  declare function generate(options: GenerateOptions): Promise<GenerateResult>;
1857
2042
 
1858
- export { CodeQualityValidator, type ValidationResult as CodeValidationResult, type ContentAnalysis, ContentAnalyzer, DeckQualityReviewer, type DeckScore, type GenerateOptions, type GenerateResult, type HardcodedViolation, type ImageGenerationRequest, type ImageGenerationResult, KnowledgeGateway, type MetricData, type NanoBananaConfig, NanoBananaProvider, type OutputFormat, PresentationEngineV2, type PresentationMetadata, type PresentationMode, type PresentationResult, type PresentationType, type QualitativeDeckReview, type QualitativeSlideReview, type RemediationResult, Remediator, Renderer, RendererV2, type Slide, type SlideContent as SlideContentV2, SlideGenerator, SlideGeneratorV2, SlideQualityReviewer, type SlideScore, type SlideType as SlideTypeV2, type SlideV2, type TableData, VERSION, type Violation, VisualDesignSystem, createNanoBananaProvider, createPresentationEngineV2, createRendererV2, createSlideGeneratorV2, generate, generatePresentation, getContentAnalyzer, getDeckQualityReviewer, getKB, getNanoBananaPrompt, getRemediator, getRenderer, getSlideGenerator, getSlideQualityReviewer, getVisualDesignSystem, initContentAnalyzer, initDeckQualityReviewer, initKB, initRemediator, initRenderer, initSlideGenerator, initSlideQualityReviewer, initVisualDesignSystem, runCodeQualityCheck, validateCodeQuality };
2043
+ export { CodeQualityValidator, type ValidationResult as CodeValidationResult, type ContentAnalysis, ContentAnalyzer, DeckQualityReviewer, type DeckScore, type GenerateOptions, type GenerateResult, type HardcodedViolation, type ImageGenerationRequest, type ImageGenerationResult, KnowledgeGateway, type MetricData, type NanoBananaConfig, NanoBananaProvider, type OutputFormat, PresentationEngineV2, type PresentationMetadata, type PresentationMode, type PresentationResult, type PresentationType, type QALoopResult, type QualitativeDeckReview, type QualitativeSlideReview, type RemediationFeedback, type RemediationResult, Remediator, Renderer, RendererV2, type Slide, type SlideContent as SlideContentV2, SlideGenerator, SlideGeneratorV2, SlideQualityReviewer, type SlideScore, type SlideType as SlideTypeV2, type SlideV2, type TableData, VERSION, type Violation, type VisualDeckAnalysis, VisualDesignSystem, VisualQAEngine, type VisualSlideAnalysis, createNanoBananaProvider, createPresentationEngineV2, createRendererV2, createSlideGeneratorV2, generate, generatePresentation, getContentAnalyzer, getDeckQualityReviewer, getKB, getNanoBananaPrompt, getRemediator, getRenderer, getSlideGenerator, getSlideQualityReviewer, getVisualDesignSystem, getVisualQAEngine, initContentAnalyzer, initDeckQualityReviewer, initKB, initRemediator, initRenderer, initSlideGenerator, initSlideQualityReviewer, initVisualDesignSystem, initVisualQAEngine, runCodeQualityCheck, validateCodeQuality };