Verified AI-Agent Built
Tier 1Claude Code
Signals: co-authored-by-claude
README
Shrinkwrap - PDF Compression Tool
A modern, Kotlin-based desktop application for compressing PDF files using Ghostscript. Built with Compose Multiplatform for a native desktop experience.
๐ Features
- Drag & Drop Interface: Simply drag PDF files onto the application
- Clipboard Support: Paste files directly with โ+V (macOS)
- Real-time Progress: Visual feedback for compression status
- Batch Processing: Handle multiple files simultaneously
- Compression Stats: Shows file size reduction percentages
- Finder Integration: Click files to reveal in Finder
๐๏ธ Architecture
The application follows a clean, modular architecture designed for maintainability and testability:
src/main/kotlin/
โโโ Main.kt # Application entry point & UI orchestration
โโโ MainViewModel.kt # State management & coordination
โโโ domain/ # Business logic layer
โ โโโ CompressionService.kt # PDF compression interface & implementation
โ โโโ FileProcessingState.kt # Domain models & state
โโโ infrastructure/ # External dependencies
โ โโโ CommandExecutor.kt # System command execution abstraction
โโโ ui/ # User interface components
โ โโโ components/
โ โ โโโ DragDropArea.kt # Drag & drop functionality
โ โ โโโ FileListItem.kt # File list item component
โ โโโ DashedBorder.kt # UI utility for dashed borders
โโโ utils/ # Common utilities
โโโ FileUtils.kt # File operations & formatting
Key Architectural Principles
- Separation of Concerns: Domain, UI, and Infrastructure layers are clearly separated
- Dependency Injection: Services can be easily mocked and tested
- Interface Segregation: Clean interfaces enable easy testing and extension
- Single Responsibility: Each class has one clear purpose
๐ ๏ธ Getting Started
Prerequisites
-
Kotlin/JVM: Project uses Kotlin with Compose Desktop
-
Ghostscript: Required for PDF compression functionality
# macOS brew install ghostscript # Ubuntu/Debian sudo apt-get install ghostscript
Building & Running
# Clone the repository
git clone <repository-url>
cd shrinkwrap
# Build the application
./gradlew build
# Run the application
./gradlew run
# Create native distribution
./gradlew createDistributable
๐งช Testing Strategy
The modular architecture enables comprehensive testing:
Unit Tests
// Service layer testing
class CompressionServiceTest {
@Test
fun `should compress valid PDF file`() {
val mockCommandExecutor = mockk<CommandExecutor>()
val service = GhostscriptCompressionService(mockCommandExecutor)
// Test without system dependencies
}
}
// State management testing
class MainViewModelTest {
@Test
fun `should update state when file is added`() {
val mockService = mockk<CompressionService>()
val viewModel = MainViewModel(mockService)
// Test state transitions
}
}
Integration Tests
- Test UI components with test state
- Test end-to-end file processing workflows
- Test error handling scenarios
๐ฎ Future Enhancements
High Priority
1. Compression Quality Settings
- Add UI controls for high/medium/low quality selection
- Remember user preferences
- Quality preview before compression
2. Enhanced Error Handling
- User-friendly error messages
- Retry mechanisms for failed compressions
- Better validation feedback
3. Progress & Performance
- Detailed progress bars for large files
- Compression speed metrics
- Estimated time remaining
Medium Priority
4. Multiple Compression Backends
// Easy to implement with current architecture
class PDFtkCompressionService : CompressionService { ... }
class ImageMagickCompressionService : CompressionService { ... }
5. Batch Operations
- Select compression quality per batch
- Pause/resume batch processing
- Export compression reports
6. File Management
- Original file backup options
- Custom output directory selection
- File name templates (e.g.,
{original}_compressed.pdf)
7. Advanced Features
- PDF optimization beyond compression
- Image quality adjustments within PDFs
- Metadata preservation options
Lower Priority
8. User Experience
- Dark/light theme toggle
- Keyboard shortcuts for common actions
- Recent files list
- Undo/redo functionality
9. Analytics & Reporting
- Compression statistics dashboard
- Export compression reports
- Historical data tracking
10. Cross-Platform Enhancements
- Windows Explorer integration
- Linux file manager integration
- Platform-specific optimizations
Technical Enhancements
11. Performance Optimizations
- Memory-efficient processing for large files
- Background compression queue
- Multi-threaded processing improvements
12. Configuration System
- Settings persistence
- Custom Ghostscript parameters
- Advanced user configurations
13. Plugin Architecture
- Custom compression algorithms
- Third-party integrations
- Extension marketplace
๐ค Contributing
Code Style
- Follow Kotlin coding conventions
- Use meaningful variable and function names
- Add KDoc comments for public APIs
- Keep functions focused and small
Testing Requirements
- Unit tests for all business logic
- UI tests for interactive components
- Integration tests for file operations
- Maintain >80% code coverage
Architecture Guidelines
- Keep domain logic pure (no UI or infrastructure dependencies)
- Use dependency injection for testability
- Create reusable UI components
- Handle errors gracefully with meaningful messages
๐ Implementation Notes
Adding New Compression Backends
- Implement
CompressionServiceinterface - Add to dependency injection in
MainViewModel - Add UI selection controls
- Update tests
Adding New UI Components
- Create in
ui/components/package - Follow existing component patterns
- Make components reusable and configurable
- Add preview functions for development
Performance Considerations
- Large files should be processed in chunks
- UI should remain responsive during processing
- Memory usage should be monitored for batch operations
๐ License
[Add your license information here]
๐ Acknowledgments
- Compose Multiplatform for the UI framework
- Ghostscript for PDF compression engine
Tags
built-with-claude-codekotlin
Similar Tools
Lex
VerifiedCrypto trade calculator
Claude Code
dev toolsTypeScript
Claude Bug Catcher
VerifiedHotkey utility for capturing Linux issues
Claude Code
dev toolsPython
Claude Rescue
VerifiedEmergency Linux recovery deployment
Claude Code
dev toolsShell
Claude Gdrive Organiser
VerifiedGoogle Drive organization via rclone
Claude Code
dev toolsPython
Opencti MCP Server
Natural language interface to OpenCTI
Claude Code
dev toolsPython
Wigvu
YouTube subtitle extraction and translation
Claude Code
dev toolsTypeScript