Merged
Conversation
Add complete URL handler system with commands for generating handler scripts, installing system handlers, and generating userscripts for external link interception in PWAs. ## New Commands - `generate-handler`: Generate URL scheme handler script with browser integration, URL decoding, and security validation - `install-handler`: Register handler with XDG MIME system, create desktop file, and update registry - `generate-userscript`: Generate userscript for intercepting external links with configurable in-scope hosts ## Implementation Details - Handler scripts decode custom URL schemes (e.g., ff://) and launch specified browser with decoded URLs - Security validation ensures only http/https URLs are accepted - XDG integration for proper system-level handler registration - Comprehensive installation instructions for userscript setup - Full support for multiple browsers (firefox, chrome, chromium, edge) - Registry integration for tracking installed handlers ## Testing - 19 new unit tests with 85-100% coverage - Tests cover handler generation, installation, and userscript creation - Tests verify dry-run mode, error handling, and edge cases - All pre-commit hooks passing (ruff, mypy, formatting) ## Documentation - Updated Implementation-specification.md Phase 4 checklist - All Phase 4 items marked as complete - Inline help text and examples in CLI commands Verification: - `pytest -m \"not playwright\" -q` - 118 tests passed - `pre-commit run --all-files` - all checks passed - Test coverage: 82% overall, 100% for userscript.py, 85% for handler.py
Add comprehensive integration tests for handler generation, installation, and userscript creation workflows. ## Test Coverage ### Handler Generation (2 tests) - Full handler script generation with executable permissions - Multiple schemes support (ff, external, custom) ### Handler Installation (2 tests) - Complete installation workflow with XDG registration - Multiple handler installation and registry tracking ### Userscript Generation (1 test) - Userscript creation with in-scope hosts configuration ### Complete Workflow (2 tests) - End-to-end workflow: generate → install → userscript - Default paths and auto-detection testing ## Key Test Scenarios - Handler script creation with proper bash syntax and security - Desktop file generation with MIME type registration - Registry integration for handler tracking - Userscript generation with correct scheme usage - XDG integration (mocked subprocess calls) - Default path resolution and auto-detection - Multiple handler support ## Testing Results ``` ✅ 7 new integration tests added ✅ 125 total tests passing (118 unit + 7 integration) ✅ 83% overall code coverage (increased from 82%) ✅ 87% coverage on handler.py (increased from 85%) ✅ 100% coverage on userscript.py (maintained) ✅ All pre-commit hooks passing ``` ## Configuration - Excluded integration tests from pre-commit mypy checks (they use test-specific patterns incompatible with strict mode) - Integration tests still validated via pyproject.toml mypy overrides The integration tests verify the complete handler workflow as specified in Phase 4 requirements (Handler generation and registration).
bigr
added a commit
that referenced
this pull request
Oct 23, 2025
- Add platform-specific locking: fcntl (Unix) and msvcrt (Windows) - Make add_app() atomic with single-lock read-check-write operation - Prevent race condition where two simultaneous adds could corrupt registry - Add type annotations to satisfy mypy strict type checking - Resolves user testing issues #6 and #7 (registry concurrency and platform locking)
bigr
added a commit
that referenced
this pull request
Oct 24, 2025
- Refactor _find_browser_executable() in handler.py to use same robust strategy as add.py - Add platform-specific path checking and shutil.which() fallback - Support Snap, Flatpak, and custom browser installations - Add comprehensive offline installation instructions across all docs - Update README.md, USAGE.md, TROUBLESHOOTING.md with PYTHONPATH method - Fix test expectations to match new error messages - Add test for browser detection via PATH fallback - Resolves second-round testing issue #9 (handler generation failures) - Resolves second-round testing issue #6 (offline installation unclear)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.