Implement in-app export preview to visualize export content safely before writing to disk
LatestRelease v0.1.7 introduces an in-app export preview modal to help users inspect generated file structures and verify content limits, ensuring sensitive files are checked and limits are validated prior to final exports.
Key Features & Enhancements:
In-Memory Preview Generation (previewGenerator.ts)
• Implemented a memory-safe PreviewBuilder utility that enforces line count (500 lines) and byte size (200 KB) ceilings on accumulated preview content.
• Implemented the core generatePreview handler that supports recursive directory walking, path verification, exclusion filtering, and binary file skip checks.
• Added helper utilities to format files with dynamic markdown backtick fences based on content analysis.
IPC Registration & Preload Bridge (ipcHandlers.ts, index.ts)
• Registered the main process IPC handler codebundle:generate-preview to isolate filesystem reads to the secure main thread.
• Exposed the generatePreview API bridge safely to the React renderer via Electron context bridge.
Export Preview Modal (ExportPreviewModal.tsx)
• Built a modal dialog featuring a glassmorphism backdrop, dynamic layout, and smooth typography.
• Rendered explicit totals for selected files, previewed files, and line counts separate from previewed text.
• Added a truncation warning notice informing users when contents exceed memory thresholds.
• Implemented copy-to-clipboard actions and direct export confirmation flows.
Application Flow & Secret Scan Integration (App.tsx, ExportControls.tsx, SecretScanWarning.tsx)
• Integrated state control variables for managing preview loading states, modal visibility, and payload storage.
• Configured export buttons to support a new secondary action button for previewing.
• Restructured the execution sequence to run the credentials/secrets scanner prior to generating the preview.
• Parameterized buttons in the secret warning modal to customize actions (e.g., Continue to Preview / Cancel Preview).
Security Design Documentation (security.md)
• Authored comprehensive security guidelines documenting path validation, local-only execution, error masking, and bounded preview limits.
Testing & Verification (previewGenerator.test.ts, exportPreviewModal.test.ts)
• Added a comprehensive suite of unit tests to verify PreviewBuilder truncation rules, binary file skip logic, and path resolution boundaries.
• Added unit tests checking the rendering layout, stats calculation, and clipboard copy targets in the React preview modal component.