feat: Add full macOS and Linux cross-platform support for binary resolution and scripts - #1
Open
Parikshitshaktawat wants to merge 1 commit into
Conversation
…olution and scripts - Abstract yt-dlp path resolution into src/yt-dlp-utils.js using a Strategy pattern that prioritizes local autodownload binaries (yt-dlp / yt-dlp.exe) and falls back to system PATH executable. - Update autodownload/watcher.js, src/autodownload-controller.js, and src/profile-download-controller.js to resolve downloader binaries dynamically. - Update scripts/doctor.js and src/setup-health.js to recognize POSIX system binaries (e.g. Homebrew / apt) and eliminate false-negative diagnostic warnings. - Add POSIX-compliant autodownload/download_tiktok.sh script with chmod +x permissions for macOS/Linux CLI users alongside Windows download_tiktok.bat. - Add unit tests in test/yt-dlp-utils.test.js covering local and fallback binary resolution. - Update README.md and SETUP.md with macOS (brew), Linux (apt), and cross-platform command instructions.
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.
Summary & Context
This PR resolves cross-platform runtime failures on macOS and Linux environments. Previously, components across the downloader and health check subsystems hardcoded Windows-specific binaries (
yt-dlp.exe) and PowerShell commands (Copy-Item), leading toENOENTexecution errors on non-Windows operating systems.This pull request introduces dynamic executable resolution, POSIX shell scripts, accurate diagnostic reporting, unit tests, and cross-platform setup documentation.
Key Changes & Architectural Rationale
1. Dynamic Binary Resolver Strategy (
src/yt-dlp-utils.js)resolveYtDlpExecutable) that inspects both OS-native local binaries (autodownload/yt-dlpvsautodownload/yt-dlp.exe) and system$PATH/%PATH%tools (e.g., installed viabrew install yt-dlporapt install yt-dlp).{ path, isLocal, exists }so UI and CLI controllers degrade gracefully instead of throwing uncaught process exceptions.2. Controller & Watcher Integration
autodownload/watcher.js,src/autodownload-controller.js, andsrc/profile-download-controller.jsto resolveyt-dlpdynamically before spawning child processes viaexecFile.3. POSIX Downloader Script (
autodownload/download_tiktok.sh)chmod +x) offering Unix CLI parity with the Windows batch scriptdownload_tiktok.bat.4. Health Diagnostics & Setup Checks (
scripts/doctor.js,src/setup-health.js)npm run doctor) and dashboard health routes (/api/setup/health) to recognize system binaries installed via package managers (Homebrew/apt), eliminating false-negative diagnostic warnings.5. Unit Tests (
test/yt-dlp-utils.test.js)6. Documentation Updates (
README.md,SETUP.md)brew) and Linux (apt) installation guides and replaced Windows-only PowerShell commands with cross-platform instructions (cp .env.example .env).Verification & Testing
npm test— all 24/24 unit tests passed.npm run check— syntax clean across 45 files.npm run doctoron macOS — all checks (Node.js,npm,FFmpeg,ffprobe,Playwright Chromium) passed cleanly.