Commit graph

10 commits

Author SHA1 Message Date
Peter Steinberger
881880d533 🧪 Add comprehensive window capture tests & fix fallback messages
Added automated tests to verify window capture functionality:
- Window bounds capture verification (checks -R flag usage)
- Window vs fullscreen size comparison
- Multi-window bounds capture testing
- Fallback message format verification
- Window capture with AI analysis

Also fixed fallback message to use Peekaboo prefix when falling back
to fullscreen capture due to inability to get window bounds.

Test additions:
- New "window" test mode for focused testing
- Added to quick and all test suites
- Comprehensive coverage of window capture edge cases

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 21:47:54 +02:00
Peter Steinberger
3515285897 🐛 Fix window capture to properly clip to app windows
Previously, window capture was falling back to fullscreen because it couldn't
get window IDs. Now using window bounds (position + size) with screencapture's
-R flag to properly capture only the app window content.

Changes:
- Use System Events to get window position and size
- Build screencapture -R command with x,y,width,height
- Added captureWindowByIndex for multi-window scenarios
- Proper error handling with fallback to fullscreen

This ensures AI analysis and screenshots only show the targeted app,
not the entire desktop.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 21:44:11 +02:00
Peter Steinberger
0b37ec090d 🚀 Peekaboo v1.0 - Smart Multi-Window AI & Enhanced CLI
Major improvements:
• 🪟 Smart Multi-Window AI: Automatically analyzes ALL windows when app has multiple
•  Timeout Protection: 90-second timeout prevents hanging on slow AI models
• 🎯 Clean CLI Design: Consistent flags (-o, -f, -w, -m, -a, -q, -v) with logical defaults
• 📝 All Messages Prefixed: "Peekaboo 👀:" for clear AI tool integration
• 🔄 Auto-Detection: Enables multi-window mode automatically for AI analysis
• 🎛️ Override Control: Use -w flag to force single window analysis

Technical changes:
- Changed version to 1.0.0 (initial release)
- Added formatMultiWindowAnalysis for consolidated AI results
- Improved error messages with proper context
- Enhanced test suite with multi-window AI tests
- Updated README with comprehensive documentation

This release provides a production-ready screenshot tool with intelligent
multi-window handling and robust AI integration.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 21:15:25 +02:00
Peter Steinberger
e9e1759f49 🤖 Enhanced AI Vision Analysis - Smart Image Compression & Ollama Setup
 Major AI functionality improvements and documentation enhancements:

📏 Smart Image Compression:
• Auto-detects large images (>5MB) and compresses to 2048px for optimal AI processing
• Uses macOS native sips tool for quality resizing while preserving aspect ratio
• Preserves original screenshots untouched while creating temporary compressed versions
• Significantly improves AI analysis speed and reliability

🛠️ Enhanced Ollama Integration:
• Fixed AppleScript file writing to handle large JSON payloads (replaces shell limitations)
• Improved base64 encoding with newline removal for clean API calls
• Added robust JSON response parsing with proper escape handling
• Enhanced error handling for model availability and API connectivity

🎯 Argument Parsing Improvements:
• Fixed flag parsing to properly handle --verbose --ask combinations
• Added fullscreen mode support for --ask without app targeting
• Improved app identifier resolution with fullscreen handling
• Enhanced validation and error reporting

📖 Comprehensive README Enhancements:
• Highlighted smart image resizing feature with technical details
• Added complete step-by-step Ollama setup guide with multiple installation options
• Enhanced model comparison table with sizes, strengths, and use cases
• Added pro usage examples showcasing automatic compression benefits
• Improved formatting with clear sections and visual highlights

🧪 AI Testing Validation:
• All AI tests now passing with reliable Ollama API integration
• Verified one-step and two-step AI analysis workflows
• Confirmed smart compression works seamlessly with various image sizes

🚀 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 19:32:47 +02:00
Peter Steinberger
a5132f53c1 🤖 Added AI Vision Analysis with Smart Model Selection
Major new feature: Local AI vision analysis with Ollama integration

Features:
• One-step: Screenshot + AI analysis in single command
• Two-step: Analyze existing images separately
• Smart model auto-detection with priority ranking
• Simplified ollama run commands (no complex API calls)
• Comprehensive error handling and setup instructions

Priority models: qwen2.5vl:7b > llava:7b > llava-phi3:3.8b > minicpm-v:8b

Examples:
osascript peekaboo.scpt "Safari" --ask "What's on this page?"
osascript peekaboo.scpt analyze "/tmp/shot.png" "Any errors?"

Perfect for automated testing, QA, and visual verification\!

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 19:02:14 +02:00
Peter Steinberger
327df522e1 Smart Filenames + Speed: Model-friendly names & 70% faster capture
Performance & UX improvements:

• Smart filename generation with app names
  - /tmp/peekaboo_safari_20250522_143052.png (includes app)
  - Model-friendly: lowercase, underscores, no spaces
  - Multi-window: safari_window_1_github.png

• Significantly reduced delays for speed
  - Capture delay: 1.0s → 0.3s (70% faster)
  - Window activation: 0.5s → 0.2s (60% faster)
  - Multi-window focus: 0.3s → 0.1s (67% faster)

• Updated documentation with new filename examples
• App names limited to 20 chars for readability

Perfect for automation and model usage\!

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 18:51:32 +02:00
Peter Steinberger
4c1c255b7c 🧹 Simplified: Removed redundant basic version, kept enhanced as main
The enhanced version has all features (multi-window, app discovery, etc.)
No need for two separate scripts - one powerful tool is better.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 18:42:30 +02:00
Peter Steinberger
e234e192b3 🚀 Enhanced UX: Optional output paths with auto /tmp defaults
Major usability improvement making Peekaboo easier to use:

• Output path now optional - auto-generates timestamped files in /tmp
• Maintains full backward compatibility with existing scripts
• Unified documentation approach (single peekaboo.scpt references)
• Streamlined setup and examples in README
• Enhanced user experience while preserving power user features

Quick usage: osascript peekaboo.scpt "Safari"
Result: /tmp/peekaboo_20250522_143052.png

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 18:42:05 +02:00
Peter Steinberger
5b2774d1ee 🔍 Enhanced Error Messages & Model Context - v1.0.0 Release Prep
 Comprehensive descriptive error handling for AI model clarity:

🎯 App Resolution Errors:
• Detailed guidance for bundle ID vs app name issues
• Specific suggestions based on identifier type
• Clear troubleshooting steps for common problems

🪟 Window-Specific Errors:
• No windows: Clear explanation + suggestions
• Inaccessible windows: Accessibility permission guidance
• Multi-window failures: Fallback mode suggestions
• Window enumeration context with counts

🔐 Permission Errors:
• Screen Recording permission with exact steps
• File permission issues with alternative paths
• Accessibility permission requirements

📸 Enhanced Success Messages:
• Detailed file information and context
• Mode descriptions (full screen, window, multi-window)
• Clear indication of what was captured
• Helpful context for multi-window results

🎪 Model-Friendly Output:
• Every error explains what went wrong AND how to fix it
• Success messages detail exactly what was accomplished
• Context always provided for AI model understanding
• Structured information for easy parsing

💡 Examples:
Error: "App 'Safari' has 3 window(s) but none are accessible.
       This may require accessibility permissions..."
Success: "Multi-window capture successful\! Captured 2 windows...
         💡 All windows captured with descriptive filenames."

🤖💥 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 18:28:49 +02:00
Peter Steinberger
d885b5954a 🎉 Peekaboo v2.0 - Complete rewrite with multi-window support
👀📸💾 — Peekaboo—screenshot got you\! Now you see it, now it's saved.

Features:
• 🎯 Two versions: Classic (simple) and Pro (advanced)
• 🚀 Unattended screenshot automation - zero interaction required
• 🎭 Multi-window capture with descriptive filenames
• 🔍 App discovery - list all running apps and windows
• 🎯 Smart app targeting - names OR bundle IDs
• 🎨 Multiple formats: PNG, JPG, PDF
• 🏗 Auto directory creation
• 💥 Enhanced error handling and logging
• 🪟 Window-specific capture modes (front window only)
• 📝 Comprehensive test suite included

Built in the style of terminator.scpt with modern enhancements.

Files:
- peekaboo.scpt: Classic version for simple screenshots
- peekaboo_enhanced.scpt: Pro version with multi-window support
- test_screenshotter.sh: Comprehensive test suite
- README.md: Punchy documentation with real-world examples

🤖💥 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-22 18:12:47 +02:00