#!/usr/bin/env python3 """ PPT Master - Error Message Helper Provides user-friendly error messages and specific fix suggestions. """ import argparse from typing import Dict, List, Optional class ErrorHelper: """Error message helper.""" # Error types and their corresponding fix suggestions ERROR_SOLUTIONS = { 'missing_readme': { 'message': 'Missing README.md file', 'solutions': [ 'Create a README.md file with project description, usage instructions, etc.', 'Reference template: examples/google_annual_report_ppt169_20251116/README.md', 'Or use command: cp examples/google_annual_report_ppt169_20251116/README.md /' ], 'severity': 'error' }, 'missing_spec': { 'message': 'Missing design specification file', 'solutions': [ 'Create a design_spec.md file', 'Include: canvas specs, color scheme, font specs, layout specs, content outline', 'Refer to the design specification generated by the Strategist role' ], 'severity': 'warning' }, 'missing_svg_output': { 'message': 'Missing svg_output directory', 'solutions': [ 'Create the svg_output directory: mkdir svg_output', 'Place generated SVG files in this directory', 'Ensure SVG files follow naming convention: slide_XX_name.svg' ], 'severity': 'error' }, 'empty_svg_output': { 'message': 'svg_output directory is empty', 'solutions': [ 'Use the AI role (Executor) to generate SVG files', 'Save SVG files to the svg_output directory', 'Ensure file naming format: slide_01_cover.svg, slide_02_content.svg, etc.' ], 'severity': 'warning' }, 'invalid_svg_naming': { 'message': 'Non-standard SVG file naming', 'solutions': [ 'Rename SVG files using format: slide_XX_name.svg', 'XX should be a two-digit number (01, 02, ...)', 'name should use English or pinyin, separated by underscores', 'Example: slide_01_cover.svg, slide_02_overview.svg' ], 'severity': 'warning' }, 'missing_project_date': { 'message': 'Project directory missing date suffix', 'solutions': [ 'Rename the project directory to add a date suffix: _YYYYMMDD', 'Format: {project_name}_{format}_{YYYYMMDD}', 'Example: my_project_ppt169_20251116', 'Command: mv old_name new_name_ppt169_20251116' ], 'severity': 'warning' }, 'viewbox_mismatch': { 'message': 'SVG viewBox does not match canvas format', 'solutions': [ 'Check the viewBox attribute of SVG files', 'Ensure it matches the project canvas format', 'PPT 16:9 should be: viewBox="0 0 1280 720"', 'PPT 4:3 should be: viewBox="0 0 1024 768"', 'Reference: references/canvas-formats.md' ], 'severity': 'warning' }, 'multiple_viewboxes': { 'message': 'Multiple different viewBox settings detected', 'solutions': [ 'Unify the viewBox across all SVG files', 'All pages in the same project should use the same canvas size', 'Use find-and-replace tools for batch correction', 'Reference the viewBox setting of the first page' ], 'severity': 'warning' }, 'no_viewbox': { 'message': 'SVG file missing viewBox attribute', 'solutions': [ 'Add the viewBox attribute to the SVG root element', 'Format: ', 'Ensure width, height are consistent with viewBox', 'This is a mandatory requirement for SVG generation' ], 'severity': 'error' }, 'foreignobject_detected': { 'message': 'Forbidden element detected', 'solutions': [ 'Remove elements', 'Use + for manual line wrapping', 'This is a project technical specification requirement', 'Reference: references/shared-standards.md' ], 'severity': 'error' }, 'clippath_on_non_image': { 'message': 'clip-path is only allowed on elements', 'solutions': [ 'Remove clip-path from shapes / groups / text', 'Draw the target geometry directly with the matching native element: / / / / . A rect clipped to a circle is just a .', 'clip-path on is conditionally allowed — see references/shared-standards.md §1.2' ], 'severity': 'error' }, 'clippath_def_missing': { 'message': 'clip-path references a id that does not exist in ', 'solutions': [ 'Define the referenced inside ', 'The clipPath must contain exactly one shape child (circle / ellipse / rect with rx,ry / path / polygon)', 'Reference: references/shared-standards.md §1.2' ], 'severity': 'error' }, 'mask_detected': { 'message': 'Forbidden element detected', 'solutions': [ 'Remove elements', 'PPT does not support SVG masks', 'Use opacity (opacity/fill-opacity) as an alternative' ], 'severity': 'error' }, 'style_element_detected': { 'message': 'Forbidden