- Add comprehensive GitHub Actions CI/CD for macOS, Windows, Linux - Create platform-specific setup actions for consistent builds - Add release workflow with binary packaging and distribution - Create installation scripts for Unix (install.sh) and Windows (install.ps1) - Add comprehensive integration and performance tests - Update README.md with full cross-platform documentation - Add CONTRIBUTING.md with platform-specific development guidelines - Support automated releases with Homebrew integration - Include proper dependency management for all platforms
8.3 KiB
Contributing to Peekaboo
Thank you for your interest in contributing to Peekaboo! This document provides guidelines and information for contributors.
🚀 Getting Started
Prerequisites
All Platforms
- Git
- Swift 5.10 or later
macOS
- Xcode 15.0 or later
- macOS 14.0 or later
Windows
- Swift for Windows toolchain
- Windows 10 or later
- Visual Studio Build Tools (recommended)
Linux
- Swift 5.10 or later
- X11 development libraries:
# Ubuntu/Debian sudo apt-get install libx11-dev libxcomposite-dev libxrandr-dev libxdamage-dev libxfixes-dev libwayland-dev pkg-config # Fedora/RHEL sudo dnf install libX11-devel libXcomposite-devel libXrandr-devel libXdamage-devel libXfixes-devel wayland-devel pkgconfig
Development Setup
-
Fork and Clone
git clone https://github.com/YOUR_USERNAME/Peekaboo.git cd Peekaboo -
Build the Project
cd peekaboo-cli swift build -
Run Tests
swift test -
Test CLI Functionality
swift run peekaboo --help
🏗️ Project Structure
Peekaboo/
├── peekaboo-cli/ # Main Swift package
│ ├── Sources/peekaboo/ # Source code
│ │ ├── Commands/ # CLI commands
│ │ ├── Platforms/ # Platform-specific implementations
│ │ │ ├── macOS/ # macOS implementations
│ │ │ ├── Windows/ # Windows implementations
│ │ │ └── Linux/ # Linux implementations
│ │ ├── Protocols/ # Cross-platform protocols
│ │ ├── Models.swift # Data models
│ │ └── PlatformFactory.swift # Platform abstraction
│ ├── Tests/ # Test files
│ └── Package.swift # Swift package manifest
├── .github/ # GitHub workflows and actions
├── scripts/ # Installation scripts
├── FEATURE_PARITY_AUDIT.md # Platform feature comparison
└── README.md # Project documentation
🎯 Contributing Guidelines
Code Style
-
Swift Style
- Follow Swift API Design Guidelines
- Use 4 spaces for indentation
- Maximum line length: 120 characters
- Use meaningful variable and function names
-
Platform-Specific Code
- Use
#if os(macOS),#if os(Windows),#if os(Linux)for platform-specific code - Keep platform-specific implementations in their respective directories
- Maintain consistent interfaces across platforms
- Use
-
Error Handling
- Use Swift's error handling mechanisms (
throws,try,catch) - Provide meaningful error messages
- Use the
ScreenCaptureErrorenum for capture-related errors
- Use Swift's error handling mechanisms (
Testing
-
Unit Tests
- Write tests for all new functionality
- Test platform-specific code on the target platform
- Use descriptive test names:
testCrossplatformScreenCapture()
-
Integration Tests
- Test end-to-end functionality
- May be skipped in CI environments without displays
- Use
XCTSkipfor environment-dependent tests
-
Performance Tests
- Include performance tests for critical operations
- Use
measureblocks for timing tests - Document expected performance characteristics
Platform-Specific Contributions
macOS Contributions
- Test on both Intel and Apple Silicon Macs
- Ensure compatibility with macOS 14.0+
- Use ScreenCaptureKit when available, CGImage as fallback
- Handle Screen Recording permissions properly
Windows Contributions
- Test on Windows 10 and 11
- Use DXGI Desktop Duplication API for screen capture
- Handle UAC elevation when necessary
- Ensure proper COM initialization/cleanup
Linux Contributions
- Test on both X11 and Wayland (when possible)
- Handle different display server protocols
- Test on major distributions (Ubuntu, Fedora, etc.)
- Manage X11 library dependencies properly
Pull Request Process
-
Before Starting
- Check existing issues and PRs to avoid duplication
- Create an issue for significant changes
- Discuss architectural changes before implementation
-
Development
- Create a feature branch:
git checkout -b feature/your-feature-name - Make atomic commits with clear messages
- Keep PRs focused and reasonably sized
- Create a feature branch:
-
Testing
- Ensure all tests pass on your platform
- Add tests for new functionality
- Test on multiple platforms when possible
-
Documentation
- Update README.md if adding user-facing features
- Update FEATURE_PARITY_AUDIT.md for platform-specific changes
- Add inline documentation for complex code
-
Submission
- Push to your fork:
git push origin feature/your-feature-name - Create a pull request with a clear description
- Link to related issues
- Be responsive to review feedback
- Push to your fork:
Commit Message Format
Use conventional commit format:
type(scope): description
[optional body]
[optional footer]
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changesrefactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Examples:
feat(windows): add DXGI screen capture implementation
fix(macos): handle permission denial gracefully
docs: update cross-platform installation instructions
test(linux): add X11 integration tests
🐛 Bug Reports
When reporting bugs, please include:
-
Environment Information
- Operating system and version
- Swift version
- Peekaboo version
-
Steps to Reproduce
- Clear, numbered steps
- Expected vs actual behavior
- Screenshots if applicable
-
Error Messages
- Full error output
- Stack traces if available
- Log files if relevant
-
Additional Context
- Display configuration (multi-monitor, scaling, etc.)
- Security software that might interfere
- Other relevant system information
💡 Feature Requests
For feature requests:
-
Check Existing Issues
- Search for similar requests
- Comment on existing issues rather than creating duplicates
-
Provide Context
- Describe the use case
- Explain why the feature would be valuable
- Consider cross-platform implications
-
Implementation Ideas
- Suggest possible approaches
- Consider platform-specific requirements
- Think about backward compatibility
🔧 Development Tips
Platform Testing
-
Local Testing
# Run platform-specific tests swift test --filter macOSTests # macOS only swift test --filter WindowsTests # Windows only swift test --filter LinuxTests # Linux only -
Cross-Platform Validation
- Use GitHub Actions for automated testing
- Test on virtual machines when possible
- Coordinate with other contributors for platform testing
Debugging
-
Enable Verbose Logging
swift run peekaboo capture-screen --verbose -
Platform-Specific Debugging
- macOS: Use Instruments for performance analysis
- Windows: Use Visual Studio debugger
- Linux: Use GDB or LLDB
Performance Considerations
-
Memory Management
- Be mindful of image memory usage
- Clean up resources promptly
- Use autoreleasing pools on macOS when needed
-
Threading
- Use async/await for I/O operations
- Keep UI operations on main thread (when applicable)
- Consider platform-specific threading models
📚 Resources
- Swift Documentation
- Swift Package Manager
- macOS ScreenCaptureKit
- Windows DXGI
- X11 Programming
- Wayland Documentation
🤝 Community
- GitHub Issues: Bug reports and feature requests
- GitHub Discussions: General questions and ideas
- Pull Requests: Code contributions and reviews
📄 License
By contributing to Peekaboo, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to Peekaboo! 🎉