Skip to content

feat: Add full macOS and Linux cross-platform support for binary resolution and scripts - #1

Open
Parikshitshaktawat wants to merge 1 commit into
Katzca:mainfrom
Parikshitshaktawat:feat/cross-platform-mac-linux-support
Open

feat: Add full macOS and Linux cross-platform support for binary resolution and scripts#1
Parikshitshaktawat wants to merge 1 commit into
Katzca:mainfrom
Parikshitshaktawat:feat/cross-platform-mac-linux-support

Conversation

@Parikshitshaktawat

Copy link
Copy Markdown

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 to ENOENT execution 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)

  • Abstracted path lookup into a central strategy (resolveYtDlpExecutable) that inspects both OS-native local binaries (autodownload/yt-dlp vs autodownload/yt-dlp.exe) and system $PATH / %PATH% tools (e.g., installed via brew install yt-dlp or apt install yt-dlp).
  • Returns structured diagnostic metadata { path, isLocal, exists } so UI and CLI controllers degrade gracefully instead of throwing uncaught process exceptions.

2. Controller & Watcher Integration

  • Updated autodownload/watcher.js, src/autodownload-controller.js, and src/profile-download-controller.js to resolve yt-dlp dynamically before spawning child processes via execFile.

3. POSIX Downloader Script (autodownload/download_tiktok.sh)

  • Added an executable bash script (chmod +x) offering Unix CLI parity with the Windows batch script download_tiktok.bat.

4. Health Diagnostics & Setup Checks (scripts/doctor.js, src/setup-health.js)

  • Updated environment checks (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)

  • Added unit tests covering local binary detection and fallback behaviors.

6. Documentation Updates (README.md, SETUP.md)

  • Added macOS (brew) and Linux (apt) installation guides and replaced Windows-only PowerShell commands with cross-platform instructions (cp .env.example .env).

Verification & Testing

  • Unit Tests: Executed npm test — all 24/24 unit tests passed.
  • Syntax Checks: Executed npm run check — syntax clean across 45 files.
  • Environment Diagnostics: Executed npm run doctor on macOS — all checks (Node.js, npm, FFmpeg, ffprobe, Playwright Chromium) passed cleanly.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant