lightgun-poc / lib/cli / CliDeps
Interface: CliDeps
Defined in: lib/cli.ts:33
Everything the CLI touches that a test wants to replace.
Properties
adb?
optionaladb?: (port,run) =>object
Defined in: lib/cli.ts:38
Runs adb reverse so the phone's localhost:<port> reaches this PC. The mapping dies on cable replug / adb restart — start:adb re-runs it each time. Failure is reported, never thrown; the server starts anyway.
The port is validated and adb is invoked with an argument array (no shell), so nothing that arrives via the CLI can smuggle extra commands in.
Parameters
port
number
run?
AdbRun = runAdb
Returns
object
detail
detail:
string
ok
ok:
boolean
appDir?
optionalappDir?:string
Defined in: lib/cli.ts:46
Directory holding the running program — where the SEA's buttons.json lives.
buildEditor?
optionalbuildEditor?: (d) =>void
Defined in: lib/cli.ts:56
Editor auto-build for serve; tests inject a noop so npm never runs.
Builds the editor when stale, logging what happened. NEVER throws: the server must start regardless of the editor's build health.
Parameters
d
Returns
void
env?
optionalenv?:Record<string,string|undefined>
Defined in: lib/cli.ts:40
error?
optionalerror?: (line) =>void
Defined in: lib/cli.ts:36
Parameters
line
string
Returns
void
exec?
optionalexec?: (cmd) =>string
Defined in: lib/cli.ts:37
Parameters
cmd
string
Returns
string
getAsset?
optionalgetAsset?: (key) =>ArrayBuffer
Defined in: lib/cli.ts:44
sea.getRawAsset, only consulted when isSea.
Parameters
key
string
Returns
ArrayBuffer
isSea?
optionalisSea?:boolean
Defined in: lib/cli.ts:42
True inside the single executable: assets are embedded, not on disk.
loadFfi?
optionalloadFfi?: () =>Promise<Ffi>
Defined in: lib/cli.ts:50
FFI loader for monitors; tests inject one so no real user32 is called.
Returns
Promise<Ffi>
loadNative?
optionalloadNative?: () =>Promise<LibNut>
Defined in: lib/cli.ts:48
Native addon loader for check; tests inject one so no real device is touched.
Returns
Promise<LibNut>
log?
optionallog?: (line) =>void
Defined in: lib/cli.ts:35
Parameters
line
string
Returns
void
onShutdown?
optionalonShutdown?: (fn) =>void
Defined in: lib/cli.ts:54
Registers teardown; tests inject one to avoid real signal handlers.
Parameters
fn
() => void
Returns
void
platform?
optionalplatform?:string
Defined in: lib/cli.ts:39
start?
optionalstart?: (opts) =>Promise<RunningServer>
Defined in: lib/cli.ts:34
Boots the whole PC side: static file serving, WebSocket intake, aim the 2ms newest-wins cursor loop, button execution and jitter stats.
Parameters
opts?
ServerOptions = {}
Returns
Promise<RunningServer>
tunnel?
optionaltunnel?: (port,d) =>Promise<Tunnel>
Defined in: lib/cli.ts:52
Public-tunnel starter; tests inject one so no agent is ever spawned.
Brings up (or adopts) an ngrok endpoint for port.
The URL comes from the agent's documented local API rather than by scraping its log lines, and an agent that is already running is reused instead of fought with — the free plan allows one session, so spawning a second one just fails.
Parameters
port
number
d?
NgrokDeps = {}
Returns
Promise<Tunnel>
Throws
When the binary is missing, the agent dies, or no endpoint appears before timeoutMs. Callers are expected to keep serving anyway: a tunnel is a convenience, and the USB and LAN flows are unaffected by its absence.