How asish231/droidhelper works
1. Repository shape
- This is a very small Go CLI project, not a multi-service system.
- Most architecture lives in a single entrypoint, main.go, with supporting launch/package files and prebuilt binaries in dist/.
2. Core role of the app
- DroidHelper is a wrapper/orchestrator around two external Android tools: adb and scrcpy.
- It does not implement mirroring itself; it coordinates discovery, pairing, connection, and final launch.
3. Primary boundary: in-process CLI vs external executables
- The Go program is the control plane.
- adb handles device discovery, pairing, and connection state.
- scrcpy handles screen/audio mirroring and device control.
- This boundary is the key architectural diagram line.
4. Interactive user flow
- The app is a guided terminal experience.
- The user chooses connection mode and audio mode, then the program translates those choices into the correct external commands.
- There is no GUI layer in the current repository.
5. Dependency/bootstrap subsystem
- At startup the helper checks whether adb and scrcpy are installed.
- If tools are missing, it prompts the user to install them.
- The README indicates this bootstrap is currently macOS-first and expects Homebrew for installation.
6. USB connection path
- In USB mode, the app starts the ADB server and inspects adb devices -l.
- It selects a connected device automatically when possible, or asks the user to choose among multiple devices.
- The selected device serial becomes the target for the final scrcpy invocation.
7. Wireless debugging path
- In wireless mode, the app guides the user through Android Wireless Debugging / pairing-code workflow.
- It uses adb mdns services to discover connect endpoints, adb pair for pairing, and adb connect for attaching to the device over the network.
- It also performs lightweight reachability checks with ping and nc -vz before attempting connection.
8. Audio-mode selection as a launch-time policy
- Audio is treated as a user-selected launch policy, not a separate subsystem.
- The app supports no audio, normal output audio, and voice-call mode.
- These map to different scrcpy flags, and voice-call mode is explicitly device/Android-version dependent.
9. Command assembly and execution
- After device selection and audio choice, the helper assembles the final scrcpy command.
- The command includes the target serial/endpoint plus the chosen audio flags.
- This is the final handoff from Go into the external mirroring engine.
10. Platform and packaging
- The repository ships compiled binaries in dist/ for macOS arm64 and Windows amd64/arm64.
- A macOS run-droidhelper.command script provides a double-click entry path and falls back to go run . if needed.
- Even though Windows binaries exist, the operational story is still centered on macOS.
11. Runtime/tooling implications
- The app depends on the local operating system having access to adb, scrcpy, and shell utilities.
- That means the architecture is strongly host-dependent and thin by design: local CLI orchestration plus external tools.
12. Diagram takeaway
- The clean architecture diagram should show:
- User → Go CLI orchestrator
- Go CLI orchestrator → adb / scrcpy / shell utilities
- adb ↔ Android device over USB or Wi‑Fi
- scrcpy ↔ Android device for mirroring/control
- The repository itself mainly contains the orchestrator and packaging around those external dependencies.
Main entry points: main.go Wireless flow · run-droidhelper.command macOS launcher · dist Prebuilt binaries
Components 16
Go CLI
In-repo control plane and launch logic.
- DroidHelper CLI · Single Go entrypoint that coordinates startup, prompting, device selection, and final launch.
main.go - Bootstrap checks · Verifies adb and scrcpy are available and prompts for installation when missing.
main.go - Mode picker · Guided terminal choice between USB and wireless connection flows.
main.go - USB flow · Starts the adb server, inspects connected devices, and selects a target serial.
main.go - Wireless flow · Guides pairing-code and wireless debugging setup before connecting over the network.
main.go - Reachability checks · Uses ping and nc -vz to confirm device reachability before adb connect.
main.go - Audio policy · Chooses no-audio, normal audio, or voice-call audio flags for scrcpy.
main.go - Command assembly · Builds the final scrcpy invocation with target device and selected flags.
main.go - Launch handoff · Executes the assembled external command and transfers control to scrcpy.
main.go
External tools
Host-installed executables and device-side endpoints.
- adb · Handles discovery, pairing, connection state, and server management.
- scrcpy · Provides device mirroring, audio routing, and control once launched.
- Shell utils · Uses ping and nc for lightweight network checks during wireless setup.
- Android device · USB or Wi-Fi target reached by adb and mirrored by scrcpy.
Packaging
Prebuilt artifacts and launch entrypoints.
- macOS launcher · Double-click entrypoint that runs the helper or falls back to go run .
run-droidhelper.command - Prebuilt binaries · Packaged macOS and Windows builds shipped in dist/.
dist
Other components
- User · Runs the guided terminal flow and chooses connection and audio options.
Connections 23
- User → DroidHelper CLI: starts · User begins the terminal workflow.
- macOS launcher → DroidHelper CLI: invokes · The macOS script launches the helper.
- Prebuilt binaries → DroidHelper CLI: ships · Release artifacts package the same orchestrator.
- DroidHelper CLI → Bootstrap checks: checks tools · Startup verifies host dependencies.
- Bootstrap checks → adb: requires · adb must be installed locally.
- Bootstrap checks → scrcpy: requires · scrcpy must be installed locally.
- Bootstrap checks → Mode picker: continues · After bootstrap, the guided flow begins.
- Mode picker → USB flow: USB · User chooses USB connection.
- Mode picker → Wireless flow: wireless · User chooses wireless debugging.
- USB flow → adb: uses · Starts the adb server and queries devices.
- USB flow → Android device: selects · Chooses a connected device serial.
- Wireless flow → Shell utils: probes · Checks local reachability before connecting.
- Wireless flow → adb: pairs/connects · Uses mdns, pair, and connect flows.
- Wireless flow → Android device: attaches · Connects to the device over the network.
- Wireless flow → Reachability checks: includes · Network checks are part of wireless setup.
- USB flow → Audio policy: passes choice · Connection outcome feeds launch policy selection.
- Wireless flow → Audio policy: passes choice · Connection outcome feeds launch policy selection.
- Audio policy → Command assembly: configures · Audio mode becomes scrcpy flags.
- Android device → Command assembly: targets · Selected serial or endpoint is embedded in the final command.
- Command assembly → scrcpy: prepares · Assembles the final mirroring invocation.
- Launch handoff → scrcpy: executes · Hand off from Go into the external mirroring engine.
- adb → Android device: connects to · adb discovers, pairs, and connects to the Android device.
- scrcpy → Android device: mirrors/control · scrcpy streams and controls the device session.