This commit is contained in:
maxpetrusenkoagent 2026-07-14 19:16:50 -07:00 committed by GitHub
commit 51474e1df8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 58 additions and 0 deletions

View File

@ -22,6 +22,39 @@
set -euo pipefail
print_usage() {
cat <<'EOF'
Usage:
gstack-ios-qa-daemon [--tailnet]
gstack-ios-qa-daemon --help
Mac-side broker for /ios-qa and /ios-design-review. By default it binds a
loopback listener for a USB-connected iPhone running the in-app StateServer.
Pass --tailnet to also open the Tailscale listener after the local tailscaled
identity probe succeeds.
Options:
--tailnet Enable the authenticated tailnet listener in addition to loopback.
-h, --help Print this help and exit without starting the daemon.
Environment:
GSTACK_IOS_DAEMON_PORT Loopback listener port. Default: 9099.
GSTACK_IOS_TARGET_UDID Target iOS device UDID. Optional.
GSTACK_IOS_TARGET_BUNDLE_ID Bundle ID hosting StateServer. Default: com.gstack.iosqa.fixture.
Readiness:
The daemon prints "READY: port=<n> pid=<pid>" once the listener is bound.
Probe local health with: curl -sf http://127.0.0.1:${GSTACK_IOS_DAEMON_PORT:-9099}/healthz
EOF
}
case "${1:-}" in
-h|--help)
print_usage
exit 0
;;
esac
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
GSTACK_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
ENTRY="$GSTACK_DIR/ios-qa/daemon/src/index.ts"

View File

@ -0,0 +1,25 @@
import { describe, expect, test } from 'bun:test';
import { spawnSync } from 'child_process';
import { join } from 'path';
const ROOT = join(import.meta.dir, '..');
const DAEMON_BIN = join(ROOT, 'bin/gstack-ios-qa-daemon');
describe('gstack-ios-qa-daemon CLI', () => {
test('--help prints usage and exits without starting the daemon', () => {
const result = spawnSync('bash', [DAEMON_BIN, '--help'], {
cwd: ROOT,
encoding: 'utf-8',
timeout: 2_000,
});
expect(result.error).toBeUndefined();
expect(result.status).toBe(0);
expect(result.stdout).toContain('Usage:');
expect(result.stdout).toContain('gstack-ios-qa-daemon');
expect(result.stdout).toContain('--tailnet');
expect(result.stdout).toContain('GSTACK_IOS_DAEMON_PORT');
expect(result.stdout).toContain('/healthz');
expect(result.stderr).toBe('');
});
});