Commit graph

26 commits

Author SHA1 Message Date
Peter Steinberger
cc73b22c6f permission checks 2025-06-08 20:25:29 +01:00
Peter Steinberger
40acc9669b Fix deadlock in ImageCommand by replacing semaphore with RunLoop
- Remove DispatchSemaphore usage that violated Swift concurrency rules
- Implement RunLoop-based async-to-sync bridging in runAsyncCapture()
- Convert all capture methods to async/await patterns
- Replace Thread.sleep with Task.sleep in async contexts
- Keep ParsableCommand for compatibility, avoid AsyncParsableCommand issues
- Add comprehensive tests and documentation
- Improve error handling and browser helper filtering

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 09:41:50 +01:00
Peter Steinberger
ab882069b4 fix: Add defensive validation for invalid image formats with automatic PNG fallback
Implements robust handling for invalid image formats (like 'bmp', 'gif', 'webp') that bypass schema validation:

- Added defensive format validation in image tool handler
- Automatic path correction to ensure file extensions match actual format used
- Warning messages in response when format fallback occurs
- Comprehensive unit and integration test coverage for edge cases

This ensures invalid formats automatically fall back to PNG as requested, preventing
Swift CLI rejection and incorrect file extensions in output paths.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 07:44:17 +01:00
Peter Steinberger
b10253ea2e Fix tests to match new executeSwiftCli signature with timeout parameter
- Update all test assertions to expect the new three-parameter signature
- Add expect.objectContaining({ timeout: expect.any(Number) }) to all executeSwiftCli assertions
- Fixed 37 test assertions across image.test.ts, image-edge-cases.test.ts, and image-tool.test.ts
- All tests now pass (297 tests passed, 17 skipped)

This completes the integration of PR #2's timeout functionality by ensuring all tests match the new function signature.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 07:24:02 +01:00
Peter Steinberger
4e20e9adbd Merge PR #2: Add timeout handling to prevent test hangs
- Adds configurable timeout support via PEEKABOO_CLI_TIMEOUT env var
- Implements proper SIGTERM/SIGKILL handling for stuck processes
- Updates tests for Linux compatibility
- Fixes hanging issues when permission dialogs appear

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
2025-06-08 07:13:21 +01:00
Peter Steinberger
ed1860d546 feat: Improve error propagation and debugging for system-level failures
- Enhanced CaptureError types to include underlying system errors
- Added comprehensive error logging in debug_logs for troubleshooting
- Fixed duplicate error output from ApplicationFinder
- Improved error details for app not found to show available applications
- Updated test expectations to match new error message formats

This ensures that errors from deep within ScreenCaptureKit and file operations
are properly surfaced to users with full context in the debug logs.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 07:08:35 +01:00
codegen-sh[bot]
271814cc90 Update tests for Linux compatibility and resolve merge conflicts
 **Merge Conflicts Resolved**
- Merged latest changes from main branch
- Resolved conflicts in docs/spec.md by keeping comprehensive specification
- Added PEEKABOO_CLI_TIMEOUT environment variable documentation

🧪 **Test Suite Updates for Linux Compatibility**
- Added platform-specific test skipping for Swift-dependent tests
- Created tests/setup.ts for global test configuration
- Updated vitest.config.ts with platform detection
- Modified integration tests to skip on non-macOS platforms:
  - tests/integration/peekaboo-cli-integration.test.ts
  - tests/integration/image-tool.test.ts
  - tests/integration/analyze-tool.test.ts

📦 **New Test Scripts**
- `npm run test:unit` - Run only unit tests (any platform)
- `npm run test:typescript` - Run TypeScript tests, skip Swift (Linux-friendly)
- `npm run test:typescript:watch` - Watch mode for TypeScript-only tests

🌍 **Platform Support**
- **macOS**: All tests run (unit + integration + Swift)
- **Linux/CI**: Only TypeScript tests run (Swift tests auto-skipped)
- **Environment Variables**:
  - `SKIP_SWIFT_TESTS=true` - Force skip Swift tests
  - `CI=true` - Auto-skip Swift tests in CI

📚 **Documentation Updates**
- Added comprehensive testing section to README.md
- Documented platform-specific test behavior
- Added environment variable documentation for test control

This allows the TypeScript parts of Peekaboo to be tested on Linux while maintaining full test coverage on macOS.
2025-06-08 06:03:49 +00:00
Peter Steinberger
2e65e000f0 fallback to png for full screen captures. 2025-06-08 06:04:09 +01:00
Peter Steinberger
94e966fa98 feat: Add fuzzy matching for application names
- Implement Levenshtein distance algorithm for fuzzy app name matching
- Handle common typos like "Chromee" → "Google Chrome"
- Add window-specific labels in analysis results
- Improve error messages with app name suggestions
- Fix TypeScript JSON parsing for error responses
- Update tests for new error message formats

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 05:22:58 +01:00
Peter Steinberger
282d00f5d9 Add auto capture focus mode and fix list tool validation
- Added new "auto" capture focus mode that intelligently brings windows to foreground only when needed
- Changed default capture_focus from "background" to "auto" for better screenshot success rates
- Fixed list tool server_status validation to allow empty include_window_details arrays
- Added comprehensive tests for new auto mode functionality
- Enhanced error messages for better user experience

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 04:31:28 +01:00
Peter Steinberger
76d0faef42 image + analyze keeps the temp files 2025-06-08 04:02:04 +01:00
Peter Steinberger
e5e8123445 add more tests 2025-06-08 03:49:11 +01:00
Peter Steinberger
10672e57c0 Prepare v1.0.0-beta.15: Improved list tool usability and robustness
### Improved
- The list tool is now more lenient and user-friendly
- item_type parameter is now optional (defaults to 'running_applications')
- Intelligent auto-detection when app parameter is provided
- Enhanced error handling and validation

### Fixed
- Fixed crash when list tool called with empty item_type
- Improved image tool path handling for temporary files
- Better error messages and validation throughout

### Tests
- Added comprehensive test coverage for new list tool features
- Enhanced integration tests for improved scenarios
- Total test count increased from 223 to 228 tests

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 02:36:13 +01:00
Peter Steinberger
f5ad072bc8 chore: bump version to 1.0.0-beta.13 2025-06-08 01:28:12 +01:00
Peter Steinberger
b1ddf6f1b6 Enhance Swift testing framework and test coverage
- Update CI configuration to use macOS-15 runner with Xcode 16.3
- Expand test coverage with comprehensive new test suites:
  * JSONOutputTests.swift - JSON encoding/decoding and MCP compliance
  * LoggerTests.swift - Thread-safe logging functionality
  * ImageCaptureLogicTests.swift - Image capture command logic
  * TestTags.swift - Centralized test tagging system
- Improve existing tests with Swift Testing patterns and async support
- Make Logger thread-safe with concurrent dispatch queue
- Add performance, concurrency, and edge case testing
- Fix compilation issues and optimize test performance

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-07 23:57:26 +01:00
Peter Steinberger
4e5e15c5a5 Prepare for 1.0.0-beta.11 release
- Update version to 1.0.0-beta.11 in package.json and Swift version file
- Update CHANGELOG.md with today's date
- Fix test expectations for new error message format
- Build universal Swift binary with latest changes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-07 22:56:33 +01:00
Peter Steinberger
7bf63a225c Implement missing best practices
- Add npm run inspector script for MCP inspector tool
- Synchronize Swift CLI version with package.json (1.0.0-beta.9)
- Update macOS version requirement to v14 (Sonoma) for n-1 support
- Add Swift compiler warnings check in prepare-release script
- Convert tests/setup.ts from Jest to Vitest syntax
- Update server status tests to match new format

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-26 23:46:03 +02:00
Peter Steinberger
72819798ff feat: Simplify image tool API and add screen index support\n\n- MCP image tool API simplified with app_target, new format:data behavior, and automatic AI provider selection.\n- Swift CLI image command now supports --screen-index for specific display capture.\n- Updated image.ts, relevant documentation, and tests accordingly.\n- Version bumped to 1.0.0-beta.4. 2025-05-25 18:31:50 +02:00
Peter Steinberger
53ec5ef9a4 Add Swift linting and enhance image capture features
- Add SwiftLint and SwiftFormat configuration with npm scripts
- Refactor Swift code to comply with linting rules:
  - Fix identifier naming (x/y → xCoordinate/yCoordinate)
  - Extract long functions into smaller methods
  - Fix code style violations
- Enhance image capture tool:
  - Add blur detection parameter
  - Support custom image formats and quality
  - Add flexible naming patterns for saved files
- Add comprehensive integration tests for image tool
- Update documentation with new linting commands

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-25 18:02:39 +02:00
Peter Steinberger
6396e299be Prepare for v1.0.0-beta.3 release 2025-05-25 14:07:21 +02:00
Peter Steinberger
ed59bb58dc Combine image + analyze 2025-05-25 13:32:39 +02:00
Peter Steinberger
6c2c327a2c Add E2E tests 2025-05-25 03:20:15 +02:00
Peter Steinberger
cac7975bbe Update tests 2025-05-25 01:34:58 +02:00
Peter Steinberger
8209adc3d0 Update to Swift 6 and rename swift-cli to peekaboo-cli
- Migrate Swift code to Swift 6 compatibility
- Rename swift-cli folder to peekaboo-cli for better naming consistency
- Update all references throughout the codebase (build scripts, imports, tests)
- Fix .gitignore to properly track Swift source files
- Update environment variable names to use PEEKABOO_ prefix

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-25 01:31:43 +02:00
Peter Steinberger
97eba5e97e Add tests; finish peekabo cli rename 2025-05-25 01:28:34 +02:00
Peter Steinberger
a7970d8de7 Add tests 2025-05-23 05:40:31 +02:00